You are here

function metatag_permission in Metatag 7

Implements hook_permission().

File

./metatag.module, line 101
Primary hook implementations for Metatag.

Code

function metatag_permission() {
  $permissions['administer meta tags'] = array(
    'title' => t('Administer meta tags'),
    'restrict access' => TRUE,
    'description' => t('Control the main settings pages and modify per-object meta tags.'),
  );
  $permissions['edit meta tags'] = array(
    'title' => t('Edit meta tags'),
    'description' => t('Modify meta tags on individual entity records (nodes, terms, users, etc).'),
  );

  // Optional extended edit permissions.
  if (variable_get('metatag_extended_permissions', FALSE)) {
    $permissions['edit meta tags']['description'] .= '<br />' . t('<em>Extended Permissions</em> has been enabled. Roles have the :admin permission will see all meta tags on edit forms, otherwise the permissions below will control which meta tags are available and are needed in addition to <em>Edit meta tags</em>.', array(
      ':admin' => t('Administer meta tags'),
    ));
    $metatags = metatag_get_info();
    foreach ($metatags['tags'] as $metatag_name => $metatag) {
      $permissions['edit meta tag: ' . $metatag_name] = array(
        'title' => t('Extended permission: Edit :tag meta tag', array(
          ':tag' => $metatag['label'],
        )),
        'description' => t('Customize the :tag meta tag on individual forms.', array(
          ':tag' => $metatag['label'],
        )),
      );
    }
  }
  return $permissions;
}