class ViewsMenuLink in Zircon Profile 8
Same name in this branch
- 8 core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php \Drupal\views\Plugin\Derivative\ViewsMenuLink
- 8 core/modules/views/src/Plugin/Menu/ViewsMenuLink.php \Drupal\views\Plugin\Menu\ViewsMenuLink
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php \Drupal\views\Plugin\Derivative\ViewsMenuLink
Provides menu links for Views.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\views\Plugin\Derivative\ViewsMenuLink implements ContainerDeriverInterface
Expanded class hierarchy of ViewsMenuLink
See also
\Drupal\views\Plugin\Menu\ViewsMenuLink
1 string reference to 'ViewsMenuLink'
- views.links.menu.yml in core/
modules/ views/ views.links.menu.yml - core/modules/views/views.links.menu.yml
File
- core/
modules/ views/ src/ Plugin/ Derivative/ ViewsMenuLink.php, line 22 - Contains \Drupal\views\Plugin\Derivative\ViewsMenuLink.
Namespace
Drupal\views\Plugin\DerivativeView source
class ViewsMenuLink extends DeriverBase implements ContainerDeriverInterface {
/**
* The view storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $viewStorage;
/**
* Constructs a \Drupal\views\Plugin\Derivative\ViewsLocalTask instance.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $view_storage
* The view storage.
*/
public function __construct(EntityStorageInterface $view_storage) {
$this->viewStorage = $view_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity.manager')
->getStorage('view'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$links = array();
$views = Views::getApplicableViews('uses_menu_links');
foreach ($views as $data) {
list($view_id, $display_id) = $data;
/** @var \Drupal\views\ViewExecutable $executable */
$executable = $this->viewStorage
->load($view_id)
->getExecutable();
$executable
->initDisplay();
$display = $executable->displayHandlers
->get($display_id);
if ($display instanceof DisplayMenuInterface && ($result = $display
->getMenuLinks())) {
foreach ($result as $link_id => $link) {
$links[$link_id] = $link + $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:: |
|
ViewsMenuLink:: |
protected | property | The view storage. | |
ViewsMenuLink:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
ViewsMenuLink:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
ViewsMenuLink:: |
public | function | Constructs a \Drupal\views\Plugin\Derivative\ViewsLocalTask instance. |