improvements-2.x-dev/modules/improvements_contact/src/Plugin/Derivative/ContactFormMessagesLocalTaskDeriver.php
modules/improvements_contact/src/Plugin/Derivative/ContactFormMessagesLocalTaskDeriver.php
<?php namespace Drupal\improvements_contact\Plugin\Derivative; use Drupal\Component\Plugin\Derivative\DeriverBase; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\improvements_contact\Plugin\Menu\LocalTask\ContactFormMessagesLocalTask; class ContactFormMessagesLocalTaskDeriver extends DeriverBase { use StringTranslationTrait; /** * {@inheritDoc} */ public function getDerivativeDefinitions($base_plugin_definition): array { if (\Drupal::moduleHandler()->moduleExists('contact_storage')) { $this->derivatives[$base_plugin_definition['id']] = [ 'title' => $this->t('Messages'), 'route_name' => 'view.contact_messages.page_1', 'base_route' => 'entity.contact_form.edit_form', 'weight' => -99, 'class' => ContactFormMessagesLocalTask::class, ]; } return $this->derivatives; } }