EntityQueryMapForm.php in GraphQL 8.3
File
src/Form/EntityQueryMapForm.php
View source
<?php
namespace Drupal\graphql\Form;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Form\FormStateInterface;
class EntityQueryMapForm extends EntityForm {
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(),
]);
$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;
}
}