/** * Constructs a new MenuLinkContent. * * @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\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition); if (!empty($this->pluginDefinition['metadata']['entity_id'])) { $entity_id = $this->pluginDefinition['metadata']['entity_id']; // Builds a list of entity IDs to take advantage of the more efficient // EntityStorageInterface::loadMultiple() in getEntity() at render time. static::$entityIdsToLoad[$entity_id] = $entity_id; } $this->entityManager = $entity_manager; $this->languageManager = $language_manager; }
/** * Constructs a new ViewsMenuLink. * * @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\EntityManagerInterface $entity_manager * The entity manager * @param \Drupal\views\ViewExecutableFactory $view_executable_factory * The view executable factory */ public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ViewExecutableFactory $view_executable_factory) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->entityManager = $entity_manager; $this->viewExecutableFactory = $view_executable_factory; }
/** * Constructs a new MenuLinkDefault. * * @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\Menu\StaticMenuLinkOverridesInterface $static_override * The static override storage. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, StaticMenuLinkOverridesInterface $static_override) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->staticOverride = $static_override; }
/** * Constructs a new InaccessibleMenuLink. * * @param \Drupal\Core\Menu\MenuLinkInterface $wrapped_link * The menu link to wrap. */ public function __construct(MenuLinkInterface $wrapped_link) { $this->wrappedLink = $wrapped_link; $plugin_definition = ['route_name' => '<front>', 'route_parameters' => [], 'url' => NULL] + $this->wrappedLink->getPluginDefinition(); parent::__construct([], $this->wrappedLink->getPluginId(), $plugin_definition); }