class SettingsHelper in Acquia Lift Connector 8
Same name and namespace in other branches
- 8.4 src/Service/Helper/SettingsHelper.php \Drupal\acquia_lift\Service\Helper\SettingsHelper
- 8.3 src/Service/Helper/SettingsHelper.php \Drupal\acquia_lift\Service\Helper\SettingsHelper
Defines the Settings Helper class.
Hierarchy
- class \Drupal\acquia_lift\Service\Helper\SettingsHelper
Expanded class hierarchy of SettingsHelper
6 files declare their use of SettingsHelper
- acquia_lift.install in ./
acquia_lift.install - Installation file for Acquia Lift module.
- acquia_lift.module in ./
acquia_lift.module - Drupal Module: Acquia Lift
- AdminSettingsForm.php in src/
Form/ AdminSettingsForm.php - Contains \Drupal\acquia_lift\Form\AdminSettingsForm.
- DataApi.php in src/
Service/ Api/ DataApi.php - Contains \Drupal\acquia_lift\Service\Api\DataApi.
- PathContext.php in src/
Service/ Context/ PathContext.php - Contains \Drupal\acquia_lift\Service\Context\PathContext.
File
- src/
Service/ Helper/ SettingsHelper.php, line 16 - Contains \Drupal\acquia_lift\Service\Helper\SettingsHelper.
Namespace
Drupal\acquia_lift\Service\HelperView source
class SettingsHelper {
/**
* Default identity type's default value.
*/
const DEFAULT_IDENTITY_TYPE_DEFAULT = 'email';
/**
* Get front-end credential settings.
*
* @param array $credential_settings
* Credential settings array.
* @return array
* Get front end settings array.
* @throws \Drupal\acquia_lift\Exception\MissingSettingsException
*/
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'],
];
}
/**
* Is an invalid credential.
*
* @param array
* Credential settings array.
* @return boolean
* True if is an invalid credential.
*/
public static function isInvalidCredential($credential_settings) {
// Required credential need to be filled.
if (empty($credential_settings['account_name']) || empty($credential_settings['api_url']) || empty($credential_settings['access_key']) || empty($credential_settings['secret_key']) || empty($credential_settings['js_path'])) {
return TRUE;
}
// URLs need to be valid.
if (!UrlHelper::isValid($credential_settings['api_url']) || !UrlHelper::isValid($credential_settings['js_path'])) {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SettingsHelper:: |
constant | Default identity type's default value. | ||
SettingsHelper:: |
public static | function | Get front-end credential settings. | |
SettingsHelper:: |
public static | function | Is an invalid credential. |