Mercurial > hg > isophonics-drupal-site
view core/lib/Drupal/Core/Layout/LayoutDefault.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\Core\Layout; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Plugin\PluginBase; /** * Provides a default class for Layout plugins. */ class LayoutDefault extends PluginBase implements LayoutInterface { /** * The layout definition. * * @var \Drupal\Core\Layout\LayoutDefinition */ protected $pluginDefinition; /** * {@inheritdoc} */ public function __construct(array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->setConfiguration($configuration); } /** * {@inheritdoc} */ public function build(array $regions) { // Ensure $build only contains defined regions and in the order defined. $build = []; foreach ($this->getPluginDefinition()->getRegionNames() as $region_name) { if (array_key_exists($region_name, $regions)) { $build[$region_name] = $regions[$region_name]; } } $build['#settings'] = $this->getConfiguration(); $build['#layout'] = $this->pluginDefinition; $build['#theme'] = $this->pluginDefinition->getThemeHook(); if ($library = $this->pluginDefinition->getLibrary()) { $build['#attached']['library'][] = $library; } return $build; } /** * {@inheritdoc} */ public function getConfiguration() { return $this->configuration; } /** * {@inheritdoc} */ public function setConfiguration(array $configuration) { $this->configuration = NestedArray::mergeDeep($this->defaultConfiguration(), $configuration); } /** * {@inheritdoc} */ public function defaultConfiguration() { return []; } /** * {@inheritdoc} */ public function calculateDependencies() { return []; } /** * {@inheritdoc} * * @return \Drupal\Core\Layout\LayoutDefinition */ public function getPluginDefinition() { return parent::getPluginDefinition(); } }