You are here

public static function WebformContentCreatorUtilities::getFormattedEncryptionProfiles in Webform Content Creator 3.x

Same name and namespace in other branches
  1. 8 src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getFormattedEncryptionProfiles()
  2. 2.x src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getFormattedEncryptionProfiles()

Get an associative array with encryption profiles and respective labels.

Return value

array Associative array with encryption profiles ids and labels.

1 call to WebformContentCreatorUtilities::getFormattedEncryptionProfiles()
WebformContentCreatorForm::form in src/Form/WebformContentCreatorForm.php
Gets the actual form array to be built.

File

src/WebformContentCreatorUtilities.php, line 313

Class

WebformContentCreatorUtilities
Provides useful functions required in Webform content creator module.

Namespace

Drupal\webform_content_creator

Code

public static function getFormattedEncryptionProfiles() {
  $profiles = [];
  $module_handler = \Drupal::service('module_handler');
  if ($module_handler
    ->moduleExists('encrypt')) {
    $profiles = \Drupal::service(self::ENTITY_TYPE_MANAGER)
      ->getStorage('encryption_profile')
      ->loadMultiple();
  }
  $result = [];
  foreach ($profiles as $k => $v) {
    $result[$k] = $v
      ->label();
  }
  return $result;
}