private function AdminSettingsForm::buildIdentityForm in Acquia Lift Connector 8.3
Same name and namespace in other branches
- 8.4 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::buildIdentityForm()
- 8 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::buildIdentityForm()
Build identity form.
Return value
array Identity form.
1 call to AdminSettingsForm::buildIdentityForm()
- AdminSettingsForm::buildForm in src/
Form/ AdminSettingsForm.php - Form constructor.
File
- src/
Form/ AdminSettingsForm.php, line 185
Class
- AdminSettingsForm
- Defines a form that configures settings.
Namespace
Drupal\acquia_lift\FormCode
private function buildIdentityForm() {
$identity_settings = $this
->config('acquia_lift.settings')
->get('identity');
$identity_parameter_display_value = $identity_settings['identity_parameter'] ?: 'identity';
$identity_type_parameter_display_value = $identity_settings['identity_type_parameter'] ?: 'identityType';
$default_identity_type_display_value = $identity_settings['default_identity_type'] ?: 'account';
$default_identity_type_default_value = $identity_settings['default_identity_type'] ?: 'email';
$form = [
'#title' => $this
->t('Identity'),
'#type' => 'details',
'#tree' => TRUE,
'#group' => 'data_collection_settings',
];
// $form['capture_identity'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Capture identity on login / register'),
// '#default_value' => $identity_settings['capture_identity'],
// ];
$form['identity_parameter'] = [
'#type' => 'textfield',
'#title' => $this
->t('Identity Parameter'),
'#description' => $this
->t('The URL link parameter for specific visitor information, such as an email address or social media username, which is sent to the Lift Profile Manager. Example using <strong>@identity_parameter_display_value</strong>: ?<strong><ins>@identity_parameter_display_value</ins></strong>=jdoe01', [
'@identity_parameter_display_value' => $identity_parameter_display_value,
]),
'#default_value' => $identity_settings['identity_parameter'],
];
$form['identity_type_parameter'] = [
'#type' => 'textfield',
'#title' => $this
->t('Identity Type Parameter'),
'#description' => $this
->t('The URL link parameter that corresponds to a Lift Profile Manager identifier type (one of the pre-defined ones or a new one you\'ve created). Example using <strong>@identity_type_parameter_display_value</strong>: ?@identity_parameter_display_value=jdoe01&<strong><ins>@identity_type_parameter_display_value</ins></strong>=@default_identity_type_default_value', [
'@identity_parameter_display_value' => $identity_parameter_display_value,
'@identity_type_parameter_display_value' => $identity_type_parameter_display_value,
'@default_identity_type_default_value' => $default_identity_type_default_value,
]),
'#default_value' => $identity_settings['identity_type_parameter'],
'#states' => [
'visible' => [
':input[name="identity[identity_parameter]"]' => [
'!value' => '',
],
],
],
];
$form['default_identity_type'] = [
'#type' => 'textfield',
'#title' => $this
->t('Default Identity Type'),
'#description' => $this
->t('The Lift Profile Manager identifier type to be used by default. Example using <strong>@default_identity_type_display_value</strong>: a visitor may visit the site through ?@identity_parameter_display_value=jdoe01 and omit the "@identity_type_parameter_display_value" query, and Lift will automatically identify this visitor as "jdoe01" of <strong><ins>@default_identity_type_display_value</ins></strong></strong> type. Leave this field blank to default to <strong>@default</strong> identity type.', [
'@default' => 'email',
'@identity_parameter_display_value' => $identity_parameter_display_value,
'@identity_type_parameter_display_value' => $identity_type_parameter_display_value,
'@default_identity_type_display_value' => $default_identity_type_display_value,
]),
'#default_value' => $identity_settings['default_identity_type'],
'#placeholder' => SettingsHelper::DEFAULT_IDENTITY_TYPE_DEFAULT,
'#states' => [
'visible' => [
':input[name="identity[identity_parameter]"]' => [
'!value' => '',
],
],
],
];
return $form;
}