/** * Constructs a new BlockPageVariant. * * @param array $configuration * A configuration array containing information about the plugin instance. * @param string $plugin_id * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\block\BlockRepositoryInterface $block_repository * The block repository. * @param \Drupal\Core\Entity\EntityViewBuilderInterface $block_view_builder * The block view builder. * @param string[] $block_list_cache_tags * The Block entity type list cache tags. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, BlockRepositoryInterface $block_repository, EntityViewBuilderInterface $block_view_builder, array $block_list_cache_tags) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->blockRepository = $block_repository; $this->blockViewBuilder = $block_view_builder; $this->blockListCacheTags = $block_list_cache_tags; }
/** * Constructs a new FullPageVariant. * * @param array $configuration * A configuration array containing information about the plugin instance. * @param string $plugin_id * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityStorageInterface $block_storage * The block entity storage. * @param \Drupal\Core\Entity\EntityViewBuilderInterface $block_view_builder * The block view builder. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The current route match. * @param \Drupal\Core\Theme\ThemeNegotiatorInterface $theme_negotiator * The theme negotiator. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $block_storage, EntityViewBuilderInterface $block_view_builder, RouteMatchInterface $route_match, ThemeNegotiatorInterface $theme_negotiator) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->blockStorage = $block_storage; $this->blockViewBuilder = $block_view_builder; $this->routeMatch = $route_match; $this->themeNegotiator = $theme_negotiator; }
/** * {@inheritdoc} */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { parent::submitConfigurationForm($form, $form_state); $this->configuration['status_code'] = $form_state->getValue('status_code'); }
/** * {@inheritdoc} */ public function setConfiguration(array $configuration) { // preserve the uuid. if ($this->configuration && !empty($this->configuration['uuid'])) { $configuration['uuid'] = $this->configuration['uuid']; } parent::setConfiguration($configuration); $this->getBlockCollection()->setConfiguration($this->configuration['blocks']); return $this; }
/** * {@inheritdoc} */ public function getConfiguration() { return ['selection_conditions' => $this->getSelectionConditions()->getConfiguration(), 'blocks' => $this->getBlockCollection()->getConfiguration()] + parent::getConfiguration(); }
/** * {@inheritdoc} */ public function __sleep() { $vars = parent::__sleep(); // Gathered contexts objects should not be serialized. if (($key = array_search('contexts', $vars)) !== FALSE) { unset($vars[$key]); } return $vars; }
/** * {@inheritdoc} */ public function setConfiguration(array $configuration) { parent::setConfiguration($configuration); $this->getBlockCollection()->setConfiguration($this->configuration['blocks']); return $this; }
/** * {@inheritdoc} */ public function defaultConfiguration() { return parent::defaultConfiguration() + array('blocks' => array(), 'selection_conditions' => array(), 'selection_logic' => 'and'); }