public function AppCallbackUrlSettingsForm::buildForm in Apigee Edge 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ AppCallbackUrlSettingsForm.php, line 50
Class
- AppCallbackUrlSettingsForm
- Provides configuration form for app callback settings.
Namespace
Drupal\apigee_edge\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$app_settings = $this
->config('apigee_edge.common_app_settings');
$form['callback_url'] = [
'#type' => 'details',
'#title' => $this
->t('Callback URL validation settings'),
'#open' => TRUE,
'#tree' => TRUE,
];
$form['callback_url']['pattern'] = [
'#type' => 'textfield',
'#title' => $this
->t('Pattern'),
'#default_value' => $app_settings
->get('callback_url_pattern'),
'#description' => $this
->t('Regular expression that a Callback URL should match. Default is "^https?:\\/\\/.*$" that ensures callback url starts with either <em>http://</em> or <em>https://</em>.'),
'#required' => TRUE,
];
$form['callback_url']['pattern_error_message'] = [
'#type' => 'textfield',
'#title' => $this
->t('Validation error message'),
'#default_value' => $app_settings
->get('callback_url_pattern_error_message'),
'#description' => $this
->t('Client-side validation error message if a callback URL does not match.'),
'#required' => TRUE,
];
$form['callback_url']['description'] = [
'#type' => 'textfield',
'#title' => $this
->t('Description'),
'#default_value' => $app_settings
->get('callback_url_description'),
'#description' => $this
->t('Description of a Callback URL field.'),
];
$form['callback_url']['placeholder'] = [
'#type' => 'textfield',
'#title' => $this
->t('Placeholder'),
'#default_value' => $app_settings
->get('callback_url_placeholder'),
'#description' => $this
->t('Placeholder for a Callback URL field.'),
];
return parent::buildForm($form, $form_state);
}