You are here

class Fz152LocalTasks in FZ152 8

Defines dynamic local tasks.

Hierarchy

Expanded class hierarchy of Fz152LocalTasks

1 string reference to 'Fz152LocalTasks'
fz152.links.task.yml in ./fz152.links.task.yml
fz152.links.task.yml

File

src/Plugin/Derivative/Fz152LocalTasks.php, line 10

Namespace

Drupal\fz152\Plugin\Derivative
View source
class Fz152LocalTasks extends DeriverBase {

  /**
   * Implement dynamic logic to provide values for the same keys as in
   * fz152.links.task.yml.
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $plugin_service = \Drupal::service('plugin.manager.fz152');
    foreach ($plugin_service
      ->getDefinitions() as $plugin_id => $plugin) {
      $instance = $plugin_service
        ->createInstance($plugin_id);
      $route_info = $instance
        ->getSettingsPage();
      $this->derivatives['fz152.admin.' . $plugin_id] = $base_plugin_definition;
      $this->derivatives['fz152.admin.' . $plugin_id]['title'] = $route_info['title'];
      $this->derivatives['fz152.admin.' . $plugin_id]['route_name'] = 'fz152.settings.' . $plugin_id;
      $this->derivatives['fz152.admin.' . $plugin_id]['base_route'] = 'fz152.settings';
      $this->derivatives['fz152.admin.' . $plugin_id]['weight'] = $route_info['weight'];
    }
    return $this->derivatives;
  }

}

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
Fz152LocalTasks::getDerivativeDefinitions public function Implement dynamic logic to provide values for the same keys as in fz152.links.task.yml. Overrides DeriverBase::getDerivativeDefinitions