You are here

function contact_storage_export_entity_operation_alter in Contact Storage Export 8

Implements hook_entity_operation_alter().

File

./contact_storage_export.module, line 32
Contains contact_storage_export.module..

Code

function contact_storage_export_entity_operation_alter(array &$operations, EntityInterface $entity) {
  if ($entity
    ->getEntityTypeId() == 'contact_form') {
    if (\Drupal::service('router.route_provider')
      ->getRouteByName("entity.contact_form.export_form")) {
      $operations['export_form'] = [
        'title' => t('Export submissions'),
        'url' => Url::fromRoute("entity.contact_form.export_form", [
          $entity
            ->getEntityTypeId() => $entity
            ->id(),
        ]),
        'weight' => 50,
      ];
    }
  }
}