public function ApiDocSettingsForm::buildForm in Apigee API Catalog 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
File
- src/
Entity/ Form/ ApiDocSettingsForm.php, line 87
Class
- ApiDocSettingsForm
- Class ApiDocSettingsForm.
Namespace
Drupal\apigee_api_catalog\Entity\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
/* @var \Drupal\apigee_api_catalog\Entity\ApiDoc $entity */
$entity = $this->entityTypeManager
->getStorage('apidoc')
->create();
$form['apigee_api_catalog_settings']['#markup'] = $this
->t('Settings for Apigee API catalog. Manage field settings using the tabs above.');
$form['additional_settings'] = [
'#type' => 'vertical_tabs',
];
$form['workflow'] = [
'#type' => 'details',
'#title' => $this
->t('Publishing options'),
'#group' => 'additional_settings',
];
$workflow_options = [
'new_revision' => $entity
->shouldCreateNewRevision(),
];
// Prepare workflow options to be used for 'checkboxes' form element.
$workflow_options_keys = array_keys(array_filter($workflow_options));
$workflow_options = array_combine($workflow_options_keys, $workflow_options_keys);
$form['workflow']['options'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Default options'),
'#default_value' => $workflow_options,
'#options' => [
'new_revision' => $this
->t('Create new revision'),
],
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Save'),
];
return $form;
}