You are here

function search_api_page_permission in Search API Pages 7

Implements hook_permission().

File

./search_api_page.module, line 126
Generate search pages using Search API indexes.

Code

function search_api_page_permission() {
  $perms = array(
    'access search_api_page' => array(
      'title' => t('Access all search pages'),
      'description' => t('Execute searches using any of the search pages.'),
    ),
  );

  // Allow separate permissions for each search page.
  foreach (search_api_page_load_multiple(FALSE, array(
    'enabled' => TRUE,
  )) as $page) {
    $perms['access ' . $page->machine_name . ' search_api_page'] = array(
      'title' => t('Access %name search page', array(
        '%name' => $page->name,
      )),
      'description' => t('Execute searches using the %name search page.', array(
        '%name' => $page->name,
      )),
    );
  }
  return $perms;
}