duplicate_role.module in Duplicate role 8
Same filename and directory in other branches
Provides functionality for duplicating roles.
File
duplicate_role.moduleView source
<?php
/**
* @file
* Provides functionality for duplicating roles.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Implements hook_entity_operation().
*/
function duplicate_role_entity_operation(EntityInterface $entity) {
$operations = [];
if ($entity
->getEntityTypeId() === 'user_role' && \Drupal::currentUser()
->hasPermission('administer duplicate role')) {
$operations['duplicate'] = [
'title' => t('Duplicate'),
'url' => Url::fromRoute('duplicaterole.overview', [
'role' => $entity
->id(),
]),
'weight' => 20,
];
}
return $operations;
}
Functions
Name | Description |
---|---|
duplicate_role_entity_operation | Implements hook_entity_operation(). |