You are here

public function EncryptService::loadEncryptionMethods in Encrypt 8.3

Returns the registered encryption method plugins.

Parameters

bool $with_deprecated: If TRUE, also return plugins marked as deprecated.

Return value

array List of encryption methods.

Overrides EncryptServiceInterface::loadEncryptionMethods

File

src/EncryptService.php, line 57

Class

EncryptService
Class EncryptService.

Namespace

Drupal\encrypt

Code

public function loadEncryptionMethods($with_deprecated = TRUE) {
  $encryption_methods = $this->encryptManager
    ->getDefinitions();

  // Unless configured to do so, hide the deprecated encryption plugins.
  $allow_deprecated = $this->configFactory
    ->get('encrypt.settings')
    ->get('allow_deprecated_plugins');
  if (!$allow_deprecated && !$with_deprecated) {
    foreach ($encryption_methods as $plugin_id => $definition) {

      // Skip deprecated methods.
      if ($definition['deprecated']) {
        unset($encryption_methods[$plugin_id]);
      }
    }
  }
  return $encryption_methods;
}