This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function Z($step) { | |
$cmb = function($next) use ($step) { | |
// the following lambda makes it a Z combinator instead of Y. But w/out lazy eval, it has to be here | |
return $step(function() use ($next) { | |
return call_user_func_array($next($next), func_get_args()); | |
}); | |
// A lazy lang can do a true Y combinator, which would look something like this instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains Drupal\Core\Plugin\Factory\ConfigDrivenFactory. | |
*/ | |
namespace Drupal\Core\Plugin\Factory; | |
use Drupal\Component\Plugin\Discovery\DiscoveryInterface; | |
use Drupal\Component\Plugin\Factory\DefaultFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Loads the correct type of ConfigEntity from a full configuration object name. | |
* | |
* ConfigEntity expects that the id passed to entity_load() will not include the | |
* config prefix used by the entity type being loaded. This is unhelpful for | |
* calling code that has the fully prefixed configuration object name and can | |
* not reliably know the specific type of ConfigEntity to load. | |
* | |
* This function figures out which type of entity the configuration object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
block_address_standalone: | |
pattern: '/block-address/standalone/{block_config}/{route}' | |
defaults: | |
_controller: 'block_controller:respond' | |
requirements: | |
_access_addressed_block: 'TRUE' | |
block_address_embedded: | |
pattern: '/block-address/embedded/{display}' | |
defaults: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains \Drupal\block\Plugin\Core\Entity\Block. | |
*/ | |
namespace Drupal\block\Plugin\Core\Entity; | |
use Drupal\Core\Config\Entity\ConfigEntityBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BlockBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
final public function getTitle() { | |
// Override titles should supersede native title logic. | |
if (isset($this->configuration['label'])) { | |
// @todo tokenization? | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains Drupal\Core\Asset\AssetGroupingInterface. | |
*/ | |
namespace Drupal\Core\Asset; | |
/** | |
* Interface defining a service that organizes sets of assets into groups. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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])) { |