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 / arrow-mixin.scss
Last active December 12, 2015 00:09
Scss mixin inspired by http://cssarrowplease.com
@mixin arrow($position, $size, $color, $border-size: 0, $border-color: transparent) {
// Box we're adding the arrow to.
position: relative;
background: $color;
@if $border-size != 0 {
border: $border-size solid $border-color;
}
// Swap the position around to the position we actually need.
$center-position: left;
@splatio
splatio / Drupal Clientside Validation Error Placment
Created April 25, 2013 08:42
Drupal Clientside Validation Module custom error placement function.
(function ($) {
Drupal.clientsideValidation.prototype.clientsideValidationBoth = function (error, element) {
error.insertBefore(element.parents('form'));
var parents;
if (element.is(":radio")) {
parents = element.parents(".form-type-checkbox-tree");
if(parents.length) {
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
@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',
);
/* Header Area */
.l-branding {
@include breakpoint($tab) {
@include grid-span(1, 1);
}
}
.l-region--header {
@include breakpoint($tab) {
@include grid-span(1, 2);
}
<?php
/**
* @file
* Contains \Drupal\hardcopy\HardcopyFormatPluginManager.
*/
namespace Drupal\hardcopy;
use Drupal\Core\Config\ConfigFactory;
<?php
class HardcopyFormatPluginManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, ConfigFactory $config) {
parent::__construct('Plugin/HardcopyFormat', $namespaces, 'Drupal\hardcopy\Annotation\HardcopyFormat');
}
}
<?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
namespace Drupal\hardcopy\Annotation;
use Drupal\Component\Annotation\Plugin;
class HardcopyFormat extends Plugin {
public $id;
<?php
namespace Drupal\hardcopy\Plugin;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\Plugin\PluginFormInterface;
interface HardcopyFormatInterface extends ConfigurablePluginInterface, PluginFormInterface {
public function getLabel();