You are here

function config_pages_permission in Config Pages 7

Implements hook_permission().

File

./config_pages.module, line 245
This module is based on Model module (https://drupal.org/project/model) and most of the comments left untouched but have entity types renamed. Suuport for features added.

Code

function config_pages_permission() {

  // We set up permisssions to manage entity types, manage all entities and the
  // permissions for each individual entity
  $permissions = array(
    'administer config_pages types' => array(
      'title' => t('Administer QTools Config Pages'),
      'description' => t('Create and delete fields for QTools Config Pages.'),
    ),
    'administer config_pagess' => array(
      'title' => t('Access QTools Config Pages'),
      'description' => t('Access Any Configuration Pages'),
    ),
  );

  //Generate permissions per config_pages
  foreach (config_pages_get_types() as $type) {
    $type_name = check_plain($type->type);

    // Edit permission.
    $permissions += array(
      "edit any {$type_name} config_pages" => array(
        'title' => t('%type_name: Edit Configuration Page', array(
          '%type_name' => $type->label,
        )),
      ),
    );
  }
  return $permissions;
}