You are here

class MicrositeMenuItemDeriver in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 modules/entity_hierarchy_microsite/src/Plugin/Deriver/MicrositeMenuItemDeriver.php \Drupal\entity_hierarchy_microsite\Plugin\Deriver\MicrositeMenuItemDeriver

Defines a class for deriving menu links from a tree.

Hierarchy

Expanded class hierarchy of MicrositeMenuItemDeriver

1 string reference to 'MicrositeMenuItemDeriver'
entity_hierarchy_microsite.links.menu.yml in modules/entity_hierarchy_microsite/entity_hierarchy_microsite.links.menu.yml
modules/entity_hierarchy_microsite/entity_hierarchy_microsite.links.menu.yml

File

modules/entity_hierarchy_microsite/src/Plugin/Deriver/MicrositeMenuItemDeriver.php, line 13

Namespace

Drupal\entity_hierarchy_microsite\Plugin\Deriver
View source
class MicrositeMenuItemDeriver extends DeriverBase implements ContainerDeriverInterface {

  /**
   * Link discovery.
   *
   * @var \Drupal\entity_hierarchy_microsite\MicrositeMenuLinkDiscoveryInterface
   */
  private $micrositeMenuLinkDiscovery;

  /**
   * Constructs a new MicrositeMenuItemDeriver.
   *
   * @param \Drupal\entity_hierarchy_microsite\MicrositeMenuLinkDiscoveryInterface $micrositeMenuLinkDiscovery
   *   Link discovery.
   */
  public function __construct(MicrositeMenuLinkDiscoveryInterface $micrositeMenuLinkDiscovery) {
    $this->micrositeMenuLinkDiscovery = $micrositeMenuLinkDiscovery;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('entity_hierarchy_microsite.menu_link_discovery'));
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $this->derivatives = $this->micrositeMenuLinkDiscovery
      ->getMenuLinkDefinitions();
    return parent::getDerivativeDefinitions($base_plugin_definition);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
MicrositeMenuItemDeriver::$micrositeMenuLinkDiscovery private property Link discovery.
MicrositeMenuItemDeriver::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
MicrositeMenuItemDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
MicrositeMenuItemDeriver::__construct public function Constructs a new MicrositeMenuItemDeriver.