You are here

class TaxonomyMenuMenuLink in Zircon Profile 8.0

Same name in this branch
  1. 8.0 modules/taxonomy_menu/src/Plugin/Derivative/TaxonomyMenuMenuLink.php \Drupal\taxonomy_menu\Plugin\Derivative\TaxonomyMenuMenuLink
  2. 8.0 modules/taxonomy_menu/src/Plugin/Menu/TaxonomyMenuMenuLink.php \Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink
Same name and namespace in other branches
  1. 8 modules/taxonomy_menu/src/Plugin/Derivative/TaxonomyMenuMenuLink.php \Drupal\taxonomy_menu\Plugin\Derivative\TaxonomyMenuMenuLink

Provides menu links for Taxonomy Menus.

Hierarchy

Expanded class hierarchy of TaxonomyMenuMenuLink

See also

\Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink

1 string reference to 'TaxonomyMenuMenuLink'
taxonomy_menu.links.menu.yml in modules/taxonomy_menu/taxonomy_menu.links.menu.yml
modules/taxonomy_menu/taxonomy_menu.links.menu.yml

File

modules/taxonomy_menu/src/Plugin/Derivative/TaxonomyMenuMenuLink.php, line 20
Contains \Drupal\taxonomy_menu\Plugin\Derivative\TaxonomyMenuMenuLink.

Namespace

Drupal\taxonomy_menu\Plugin\Derivative
View source
class TaxonomyMenuMenuLink extends DeriverBase implements ContainerDeriverInterface {

  /**
   * The taxonomy menu storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $taxonomyMenuStorage;

  /**
   * Sets up the storage handler.
   *
   * @param \Drupal\Core\Entity\EntityStorageInterface $taxonomy_menu_storage
   *   The taxonomy menu storage.
   */
  public function __construct(EntityStorageInterface $taxonomy_menu_storage) {
    $this->taxonomyMenuStorage = $taxonomy_menu_storage;
  }

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

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $links = array();

    /** @var $taxonomy_menus \Drupal\taxonomy_menu\TaxonomyMenuInterface[] */
    $taxonomy_menus = $this->taxonomyMenuStorage
      ->loadMultiple();
    foreach ($taxonomy_menus as $taxonomy_menu) {
      $links = array_merge($links, $taxonomy_menu
        ->getLinks($base_plugin_definition));
    }
    return $links;
  }

}

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
TaxonomyMenuMenuLink::$taxonomyMenuStorage protected property The taxonomy menu storage.
TaxonomyMenuMenuLink::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
TaxonomyMenuMenuLink::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
TaxonomyMenuMenuLink::__construct public function Sets up the storage handler.