class TaxonomyMenuMenuLink in Taxonomy menu 8.3
Same name in this branch
- 8.3 src/Plugin/Derivative/TaxonomyMenuMenuLink.php \Drupal\taxonomy_menu\Plugin\Derivative\TaxonomyMenuMenuLink
- 8.3 src/Plugin/Menu/TaxonomyMenuMenuLink.php \Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink
Provides menu links for Taxonomy Menus.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\taxonomy_menu\Plugin\Derivative\TaxonomyMenuMenuLink implements ContainerDeriverInterface
Expanded class hierarchy of TaxonomyMenuMenuLink
See also
\Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink
1 string reference to 'TaxonomyMenuMenuLink'
File
- src/
Plugin/ Derivative/ TaxonomyMenuMenuLink.php, line 15
Namespace
Drupal\taxonomy_menu\Plugin\DerivativeView 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_type.manager')
->getStorage('taxonomy_menu'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$links = [];
/* @var $taxonomy_menus \Drupal\taxonomy_menu\TaxonomyMenuInterface[] */
$taxonomy_menus = $this->taxonomyMenuStorage
->loadMultiple();
// MenuLinkContent entity, menulinkcontent table, look for data.
foreach ($taxonomy_menus as $taxonomy_menu) {
/* @var $taxonomy_menu \Drupal\taxonomy_menu\TaxonomyMenuInterface */
$taxonomy_menu
->getMenu();
$links = array_merge($links, $taxonomy_menu
->getLinks($base_plugin_definition));
}
return $links;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
TaxonomyMenuMenuLink:: |
protected | property | The taxonomy menu storage. | |
TaxonomyMenuMenuLink:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
TaxonomyMenuMenuLink:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
TaxonomyMenuMenuLink:: |
public | function | Sets up the storage handler. |