public function ViewsMenuLink::getDerivativeDefinitions in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php \Drupal\views\Plugin\Derivative\ViewsMenuLink::getDerivativeDefinitions()
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- core/
modules/ views/ src/ Plugin/ Derivative/ ViewsMenuLink.php, line 53 - Contains \Drupal\views\Plugin\Derivative\ViewsMenuLink.
Class
- ViewsMenuLink
- Provides menu links for Views.
Namespace
Drupal\views\Plugin\DerivativeCode
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;
}