You are here

function boxes_permission in Boxes 7.2

Same name and namespace in other branches
  1. 7 boxes.module \boxes_permission()

Implements hook_permissions().

1 call to boxes_permission()
BoxSetup::addAdminUser in ./boxes.test

File

./boxes.module, line 470

Code

function boxes_permission() {
  $perms = array(
    'administer box types' => array(
      'title' => t('Administer block types'),
      'description' => t('Create and delete fields on boxes, and set their permissions.'),
    ),
    'administer boxes' => array(
      'title' => t('Administer boxes'),
      'description' => t('Edit and view all boxes.'),
    ),
    'edit box view mode' => array(
      'title' => t('Change the View Mode of the box'),
      'description' => t('Ability to change the view mode on the box form'),
    ),
  );

  // Add a Permission for each entity type.
  foreach (boxes_get_types() as $box_type) {
    $box_type_name = check_plain($box_type->type);
    $perms += array(
      "create any {$box_type_name} boxes" => array(
        'title' => t('%type_name: add box', array(
          '%type_name' => $box_type
            ->getLabel(),
        )),
      ),
      "edit any {$box_type_name} boxes" => array(
        'title' => t('%type_name: Edit box', array(
          '%type_name' => $box_type
            ->getLabel(),
        )),
      ),
      "view any {$box_type_name} boxes" => array(
        'title' => t('%type_name: View box', array(
          '%type_name' => $box_type
            ->getLabel(),
        )),
      ),
      "delete any {$box_type_name} boxes" => array(
        'title' => t('%type_name: delete box', array(
          '%type_name' => $box_type
            ->getLabel(),
        )),
      ),
    );
  }
  return $perms;
}