You are here

public function KeyRepository::getKeysByType in Key 8

Get keys that use the specified key type.

Parameters

string $key_type_id: The key type ID to use.

Return value

\Drupal\key\Entity\Key[] An array of key objects indexed by their ids.

Overrides KeyRepositoryInterface::getKeysByType

2 calls to KeyRepository::getKeysByType()
KeyRepository::getKeyNamesAsOptions in src/KeyRepository.php
Get an array of key names, useful as options in form fields.
KeyRepository::getKeysByTypeGroup in src/KeyRepository.php
Get keys that use a key type in the specified group.

File

src/KeyRepository.php, line 77

Class

KeyRepository
Provides a repository for Key configuration entities.

Namespace

Drupal\key

Code

public function getKeysByType($key_type_id) {
  return $this->entityTypeManager
    ->getStorage('key')
    ->loadByProperties([
    'key_type' => $key_type_id,
  ]);
}