class Permissions in Search API Autocomplete 8
Provides permissions of the search_api_autocomplete module.
Hierarchy
- class \Drupal\search_api_autocomplete\Permissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of Permissions
File
- src/
Permissions.php, line 13
Namespace
Drupal\search_api_autocompleteView source
class Permissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The entity storage service.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $storage;
/**
* Constructs a Permissions object.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage service.
*/
public function __construct(EntityStorageInterface $storage) {
$this->storage = $storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('entity_type.manager')
->getStorage('search_api_autocomplete_search'));
}
/**
* Returns a list of permissions, one per configured search.
*
* @return array[]
* A list of permission definitions, keyed by permission machine name.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Permissions:: |
protected | property | The entity storage service. | |
Permissions:: |
public | function | Returns a list of permissions, one per configured search. | |
Permissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Permissions:: |
public | function | Constructs a Permissions object. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |