function pardot_entity_operation_alter in Pardot Integration 2.x
Implements hook_entity_operation_alter().
File
- ./
pardot.module, line 81 - Contains pardot.module.
Code
function pardot_entity_operation_alter(array &$operations, EntityInterface $entity) {
$has_permission = \Drupal::currentUser()
->hasPermission('administer pardot form map');
$has_link = $entity
->hasLinkTemplate('pardot-form-mapping');
$is_contact_form = $entity
->getEntityTypeId() === 'contact_form';
if ($is_contact_form && $has_link && $has_permission) {
$operations['pardot-form-mapping'] = [
'title' => t('Pardot Form Map'),
'weight' => 100,
'url' => $entity
->toUrl('pardot-form-mapping'),
];
}
}