You are here

public function Permissions::bySearch in Search API Autocomplete 8

Returns a list of permissions, one per configured search.

Return value

array[] A list of permission definitions, keyed by permission machine name.

1 string reference to 'Permissions::bySearch'
search_api_autocomplete.permissions.yml in ./search_api_autocomplete.permissions.yml
search_api_autocomplete.permissions.yml

File

src/Permissions.php, line 49

Class

Permissions
Provides permissions of the search_api_autocomplete module.

Namespace

Drupal\search_api_autocomplete

Code

public function bySearch() {
  $perms = [];

  /** @var \Drupal\search_api_autocomplete\SearchInterface $search */
  foreach ($this->storage
    ->loadMultiple() as $id => $search) {
    $perms['use search_api_autocomplete for ' . $id] = [
      'title' => $this
        ->t('Use autocomplete for the %search search', [
        '%search' => $search
          ->label(),
      ]),
    ];
  }
  return $perms;
}