public function AppApiKeyAddFormBase::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 FormInterface::buildForm
2 calls to AppApiKeyAddFormBase::buildForm()
- DeveloperAppApiKeyAddForm::buildForm in src/
Form/ DeveloperAppApiKeyAddForm.php - Form constructor.
- TeamAppApiKeyAddForm::buildForm in modules/
apigee_edge_teams/ src/ Form/ TeamAppApiKeyAddForm.php - Form constructor.
2 methods override AppApiKeyAddFormBase::buildForm()
- DeveloperAppApiKeyAddForm::buildForm in src/
Form/ DeveloperAppApiKeyAddForm.php - Form constructor.
- TeamAppApiKeyAddForm::buildForm in modules/
apigee_edge_teams/ src/ Form/ TeamAppApiKeyAddForm.php - Form constructor.
File
- src/
Form/ AppApiKeyAddFormBase.php, line 90
Class
- AppApiKeyAddFormBase
- Provides app API key add base form.
Namespace
Drupal\apigee_edge\FormCode
public function buildForm(array $form, FormStateInterface $form_state, ?AppInterface $app = NULL) {
$this->app = $app;
$form['owner'] = [
'#type' => 'value',
'#value' => $this
->getAppOwner(),
];
$form['message'] = [
'#type' => 'html_tag',
'#tag' => 'h3',
'#value' => $this
->t('Do you really want to create a new API key for this @entity_type?', [
'@entity_type' => mb_strtolower($app
->getEntityType()
->getSingularLabel()),
]),
];
$form['expiry'] = [
'#type' => 'select',
'#title' => $this
->t('Set an expiry date'),
'#required' => TRUE,
'#options' => [
'never' => $this
->t('Never'),
'date' => $this
->t('Date'),
],
'#default_value' => 'never',
];
$form['expiry_date'] = [
'#type' => 'date',
'#title' => $this
->t('Select date'),
'#states' => [
'visible' => [
':input[name="expiry"]' => [
'value' => 'date',
],
],
],
];
$form['actions'] = [
'#type' => 'actions',
'cancel' => [
'#type' => 'link',
'#title' => $this
->t('Cancel'),
'#attributes' => [
'class' => [
'button',
],
],
'#url' => $this
->getRedirectUrl(),
],
'submit' => [
'#type' => 'submit',
'#value' => $this
->t('Confirm'),
'#button_type' => 'primary',
],
];
$form['#attached']['library'][] = 'apigee_edge/apigee_edge.components';
$form['#attributes']['class'][] = 'apigee-edge--form';
return $form;
}