You are here

public static function SettingsHelper::getFrontEndCredentialSettings in Acquia Lift Connector 8

Get front-end credential settings.

Parameters

array $credential_settings: Credential settings array.

Return value

array Get front end settings array.

Throws

\Drupal\acquia_lift\Exception\MissingSettingsException

3 calls to SettingsHelper::getFrontEndCredentialSettings()
acquia_lift_page_attachments in ./acquia_lift.module
Implements hook_page_attachments().
SettingsHelperTest::testGetFrontEndCredentialSettings in tests/src/Unit/Service/Helper/SettingsHelperTest.php
Tests the getFrontEndCredentialSettings() method.
SettingsHelperTest::testGetFrontEndCredentialSettingsException in tests/src/Unit/Service/Helper/SettingsHelperTest.php
Tests the getFrontEndCredentialSettings() method's Exception.

File

src/Service/Helper/SettingsHelper.php, line 31
Contains \Drupal\acquia_lift\Service\Helper\SettingsHelper.

Class

SettingsHelper
Defines the Settings Helper class.

Namespace

Drupal\acquia_lift\Service\Helper

Code

public static function getFrontEndCredentialSettings($credential_settings) {
  if (empty($credential_settings['account_name']) || !isset($credential_settings['customer_site']) || empty($credential_settings['js_path'])) {
    throw new MissingSettingsException('Cannot generate front-end credential settings because some settings are missing.');
  }
  return [
    'account_name' => $credential_settings['account_name'],
    'customer_site' => $credential_settings['customer_site'],
    'js_path' => $credential_settings['js_path'],
  ];
}