function DynamicLocalTasks::getDerivativeDefinitions

Same name in this branch
  1. 11.x core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
Same name in other branches
  1. 9 core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  2. 9 core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  3. 8.9.x core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  4. 8.9.x core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  5. 10 core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  6. 10 core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php, line 64

Class

DynamicLocalTasks
Generates media-related local tasks.

Namespace

Drupal\media\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    // Provide an edit_form task if standalone media URLs are enabled.
    $this->derivatives["entity.media.canonical"] = [
        'route_name' => "entity.media.canonical",
        'title' => $this->t('Edit'),
        'base_route' => "entity.media.canonical",
        'weight' => 1,
    ] + $base_plugin_definition;
    if ($this->config
        ->get('standalone_url')) {
        $this->derivatives["entity.media.canonical"]['title'] = $this->t('View');
        $this->derivatives["entity.media.edit_form"] = [
            'route_name' => "entity.media.edit_form",
            'title' => $this->t('Edit'),
            'base_route' => 'entity.media.canonical',
            'weight' => 2,
        ] + $base_plugin_definition;
    }
    $this->derivatives["entity.media.delete_form"] = [
        'route_name' => "entity.media.delete_form",
        'title' => $this->t('Delete'),
        'base_route' => "entity.media.canonical",
        'weight' => 10,
    ] + $base_plugin_definition;
    return $this->derivatives;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.