Skip to content

Instantly share code, notes, and snippets.

View sdboyer's full-sized avatar

sam boyer sdboyer

View GitHub Profile
block_address_standalone:
pattern: '/block-address/standalone/{block_id}/{route}'
defaults:
_controller: 'block_controller:respond'
requirements:
_access_addressed_block: 'TRUE'
block_address_embedded:
pattern: '/block-address/embedded/{display}/{block_id}'
defaults:
@sdboyer
sdboyer / gist:5606040
Created May 18, 2013 23:07
rough assessment of the blocks we have that break data encapsulation
- BookNavigationBlock
- menu_get_object() called from build, in search of a node
- book_get_books() called, if in "all pages" mode, to search out book/current page associations
- lots of menu_tree_output(), etc., called, which relies on current path info
- ActiveTopicsBlock and NewTopicsBlock
- not breaking data encapsulation, but calls drupal_render_cache_by_query()
- LanguageBlock
- menu_is_front_page()/current_path()
@sdboyer
sdboyer / AssetGroupingInterface.php
Created May 23, 2013 20:35
AssetGroupingInterface
<?php
/**
* @file
* Contains Drupal\Core\Asset\AssetGroupingInterface.
*/
namespace Drupal\Core\Asset;
/**
* Interface defining a service that organizes sets of assets into groups.
@sdboyer
sdboyer / theme.php
Last active December 17, 2015 18:09
notes on what to do with page preprocessing
<?php
function template_preprocess_page(&$variables) {
$language_interface = language(LANGUAGE_TYPE_INTERFACE); // DC
$site_config = config('system.site'); // DC
// Move some variables to the top level for themer convenience and template cleanliness.
$variables['show_messages'] = $variables['page']['#show_messages']; // Bad
foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
if (!isset($variables['page'][$region_key])) {
WD php: Notice: Undefined index: module in Drupal\block\BlockPluginBag->initializePlugin() (line [notice]
60 of /Users/sdboyer/ws/dd/8dev/core/modules/block/lib/Drupal/block/BlockPluginBag.php). [73.62
sec, 64.69 MB]
WD php: Drupal\Component\Plugin\Exception\PluginException: The plugin (menu_navigation) did not [error]
specify an instance class. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass()
(line 62 of
/Users/sdboyer/ws/dd/8dev/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php). [73.63
sec, 64.5 MB]
Drupal\Component\Plugin\Exception\PluginException: The plugin (menu_navigation) did not specify an instance class. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 62 of /Users/sdboyer/ws/dd/8dev/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
Drush command terminated abnormally due to an unrecoverable error. [73.63 sec, 64.49 MB] [error]
<?php
/**
* @file
* Contains Drupal\block\DefaultBlockController.
*/
namespace Drupal\block;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Page\HtmlFragment;
@sdboyer
sdboyer / classes.yaml
Last active December 18, 2015 07:00 — forked from Snugug/classes.yaml
groupings:
layout-small: 'Small layout, active until 559px'
layout-medium: 'Medium Layout, active at 600px'
classes:
l-s-1-4:
group: layout-small
description: 'Span one of four columns'
l-s-2-4:
group: layout-small
description: 'Span two of four columns'
layout: 'static_layout:layout__core'
layoutSettings: { }
masterId: ''
masterType: display
id: frontend
uuid: 9e0f88e3-9683-4a0c-8e00-b84c041ac835
status: '1'
langcode: en
blockInfo:
block.block.bartik.help:
<?php
/**
* @file
* Contains \Drupal\menu\Plugin\Block\MenuBlock.
*/
namespace Drupal\menu\Plugin\Block;
use Drupal\system\Plugin\Block\SystemMenuBlock;
@sdboyer
sdboyer / BlockBase.php
Created June 20, 2013 14:20
blocks with titling methods
<?php
/**
* @file
* Contains \Drupal\block\BlockBase.
*/
namespace Drupal\block;
use Drupal\Component\Plugin\ContextAwarePluginBase;