You are here

function command_buttons_permission in Command Buttons 7

Implements hook_permission()

File

./command_buttons.module, line 268

Code

function command_buttons_permission() {
  $perms = array(
    'administer command buttons' => array(
      'title' => t('Administer command buttons'),
      'description' => t('Allows users to add and manage command buttons.'),
    ),
  );
  $entity_info = entity_get_info('command_button');
  foreach ($entity_info['bundles'] as $bundle => $info) {
    $perms["create button {$bundle}"] = array(
      'title' => t('Create new %type', array(
        '%type' => $info['label'],
      )),
      'description' => t('Allows users to create new command buttons of bundle %type.', array(
        '%type' => $info['label'],
      )),
    );
    $perms["edit button {$bundle}"] = array(
      'title' => t('Edit %type', array(
        '%type' => $info['label'],
      )),
      'description' => t('Allows users to edit command buttons of bundle %type. This is a minimum permission; it is required to be able to edit a command button at all, but higher access requirements on an individual button can override it.', array(
        '%type' => $info['label'],
      )),
    );
    $perms["delete button {$bundle}"] = array(
      'title' => t('Delete %type', array(
        '%type' => $info['label'],
      )),
      'description' => t('Allows users to delete command buttons of bundle %type.', array(
        '%type' => $info['label'],
      )),
    );
  }
  return $perms;
}