function paragraphs_bundle_permissions_permission in Paragraphs 7
Implements hook_permission().
File
- modules/
paragraphs_bundle_permissions/ paragraphs_bundle_permissions.module, line 44 - Add view / create / update / delete permissions for all paragraph bundles.
Code
function paragraphs_bundle_permissions_permission() {
$perms = array(
'bypass paragraphs bundle content access' => array(
'title' => t('Bypass paragraphs bundle content access control'),
'description' => t('Is able to administer content for all paragraph bundles'),
),
);
// Add permissions for each bundle.
$bundles = paragraphs_bundle_load();
foreach ($bundles as $machine_name => $bundle) {
$perms += array(
'view paragraph content ' . $machine_name => array(
'title' => t('%type_name: View content', array(
'%type_name' => $bundle->name,
)),
'description' => t('Is able to view paragraphs content of bundle %type_name', array(
'%type_name' => $bundle->name,
)),
),
'create paragraph content ' . $machine_name => array(
'title' => t('%type_name: Create content', array(
'%type_name' => $bundle->name,
)),
'description' => t('Is able to create paragraphs content of bundle %type_name', array(
'%type_name' => $bundle->name,
)),
),
'update paragraph content ' . $machine_name => array(
'title' => t('%type_name: Edit content', array(
'%type_name' => $bundle->name,
)),
'description' => t('Is able to update paragraphs content of bundle %type_name', array(
'%type_name' => $bundle->name,
)),
),
'delete paragraph content ' . $machine_name => array(
'title' => t('%type_name: Delete content', array(
'%type_name' => $bundle->name,
)),
'description' => t('Is able to delete paragraphs content of bundle %type_name', array(
'%type_name' => $bundle->name,
)),
),
);
}
return $perms;
}