public function EntityQueryMapForm::buildForm in GraphQL 8.3
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 EntityForm::buildForm
File
- src/
Form/ EntityQueryMapForm.php, line 16
Class
- EntityQueryMapForm
- Form controller for GraphQL query map forms.
Namespace
Drupal\graphql\FormCode
public function buildForm(array $form, FormStateInterface $formState = NULL) {
$form = parent::buildForm($form, $formState);
$form['#title'] = $this
->t('Query map version %version', [
'%version' => $this->entity
->id(),
]);
/** @var \Drupal\graphql\Entity\QueryMapInterface $entity */
$entity = $this->entity;
foreach ($entity
->get('map') as $id => $query) {
$form['map'][$id] = [
'#title' => $this
->t('ID %id', [
'%id' => $id,
]),
'#type' => 'textarea',
'#default_value' => $query,
'#disabled' => TRUE,
'#rows' => 15,
];
}
$form['actions'] = [
'delete' => [
'#type' => 'link',
'#title' => $this
->t('Back'),
'#url' => $entity
->toUrl('collection'),
],
];
return $form;
}