function contact_emails_entity_operation_alter in Contact Emails 8
Implements hook_entity_operation_alter().
File
- ./
contact_emails.module, line 118 - Contains contact_emails.module..
Code
function contact_emails_entity_operation_alter(array &$operations, $entity) {
/** @var EntityInterface $entity */
if ($entity
->getEntityTypeId() == 'contact_form') {
if (\Drupal::service('router.route_provider')
->getRouteByName("entity.contact_email.collection")) {
if ($entity
->id() != 'personal') {
$operations['email_settings'] = [
'title' => t('Manage emails'),
'url' => Url::fromRoute("entity.contact_email.collection", [
'contact_form' => $entity
->id(),
]),
'weight' => 50,
];
}
}
}
}