You are here

function search_by_page_permission in Search by Page 8

Same name and namespace in other branches
  1. 7 search_by_page.module \search_by_page_permission()

Implements hook_permission().

1 call to search_by_page_permission()
SearchByPageEnvironmentTest::setUp in tests/src/Functional/SearchByPageEnvironmentTest.php

File

./search_by_page.module, line 776
Main module file for Drupal module Search by Page.

Code

function search_by_page_permission() {
  $perms = [];
  $perms['administer search by page'] = [
    'title' => t('Administer Search by Page'),
  ];
  $envs = search_by_page_list_environments();
  foreach ($envs as $envid) {
    $name = search_by_page_setting_get('environment_name', $envid, t('new'));
    $hrname = $name;
    if (\Drupal::moduleHandler()
      ->moduleExists('i18n_string')) {
      $hrname = i18n_string_translate('search_by_page:environment:name' . $envid, $name);
    }
    $perms['search page environment ' . $name] = [
      'title' => t('Search environment @name in Search by Page', [
        '@name' => $hrname,
      ]),
    ];
  }
  return $perms;
}