You are here

function dynamic_background_permission in Dynamic Background 7.2

Same name and namespace in other branches
  1. 7 dynamic_background.module \dynamic_background_permission()

Implements hook_permission().

File

./dynamic_background.module, line 15
This module enables administrators to upload images used as background on the site. The selected background image link is exposed as either $background in the page.tpl file or as /background.css.

Code

function dynamic_background_permission() {
  $permissions = array(
    'dynamic backgrounds set default' => array(
      'title' => t('Set global dynamic backgrounds'),
    ),
    'dynamic backgrounds css callback' => array(
      'title' => t('Access dynamic backgrounds css'),
    ),
    'dynamic backgrounds weight' => array(
      'title' => t('Re-order dynamic backgrounds weight'),
    ),
  );

  // Build permissions for the extensions.
  foreach (module_implements('dynamic_background_info') as $module) {
    $function = $module . '_dynamic_background_info';
    $result = $function();
    if ($result && is_array($result)) {
      $permissions['dynamic background configure ' . $result['type']] = array(
        'title' => 'Configure ' . $module . ' settings',
      );
      $permissions['dynamic background upload ' . $result['type']] = array(
        'title' => 'Allow image upload: ' . $module,
      );
    }
  }
  return $permissions;
}