Skip to content

Instantly share code, notes, and snippets.

View splatio's full-sized avatar

Matthew Smith splatio

  • Huddersfield, UK
View GitHub Profile
@splatio
splatio / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
namespace Drupal\hardcopy\Plugin;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\hardcopy\HardcopyCssIncludeInterface;
use Drupal\Core\Page\HtmlPage;
use Drupal\hardcopy\LinkExtractor\LinkExtractorInterface;
<?php
namespace Drupal\hardcopy\Plugin;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\Plugin\PluginFormInterface;
interface HardcopyFormatInterface extends ConfigurablePluginInterface, PluginFormInterface {
public function getLabel();
<?php
namespace Drupal\hardcopy\Annotation;
use Drupal\Component\Annotation\Plugin;
class HardcopyFormat extends Plugin {
public $id;
<?php
class HardcopyFormatPluginManager extends DefaultPluginManager {
protected $config;
public function __construct(\Traversable $namespaces, ConfigFactory $config) {
$this->config = $config;
parent::__construct('Plugin/HardcopyFormat', $namespaces, 'Drupal\hardcopy\Annotation\HardcopyFormat');
}
<?php
class HardcopyFormatPluginManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, ConfigFactory $config) {
parent::__construct('Plugin/HardcopyFormat', $namespaces, 'Drupal\hardcopy\Annotation\HardcopyFormat');
}
}
<?php
/**
* @file
* Contains \Drupal\hardcopy\HardcopyFormatPluginManager.
*/
namespace Drupal\hardcopy;
use Drupal\Core\Config\ConfigFactory;
/* Header Area */
.l-branding {
@include breakpoint($tab) {
@include grid-span(1, 1);
}
}
.l-region--header {
@include breakpoint($tab) {
@include grid-span(1, 2);
}
@splatio
splatio / omega-no-query.php
Last active December 22, 2015 01:59
No query fallback handling in Omega.
<?php
// Allow themes to specify no-query fallback CSS files.
$mapping = omega_generate_asset_mapping($css);
foreach (preg_grep('/\.no-query(-rtl)?\.css/', $mapping) as $fallback) {
// Don't modify browser settings if they have already been modified.
if ($css[$mapping[$fallback]]['data'] == $fallback && $file['browsers']['IE'] && $file['browsers']['!IE']) {
$file['browsers'] = array(
'!IE' => FALSE,
'IE' => 'lte IE 8',
);
diff --git a/template.php b/template.php
index 86e8d7a..37b4c60 100644
--- a/template.php
+++ b/template.php
@@ -623,13 +623,18 @@ function omega_template_process_html_override(&$variables) {
*/
function omega_block_list_alter(&$blocks) {
if (omega_extension_enabled('layouts') && $layout = omega_layout()) {
- // In case we are currently serving a Omega layout we have to make sure that
- // we don't process blocks that will never be shown because the active layout