public function ManageResolverRelationships::buildForm in Chaos Tool Suite (ctools) 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 FormInterface::buildForm
File
- src/
Form/ ManageResolverRelationships.php, line 81
Class
- ManageResolverRelationships
- Provider manage resolver relationships.
Namespace
Drupal\ctools\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$cached_values = $form_state
->getTemporaryValue('wizard');
$this->machine_name = $cached_values['id'];
$form['items'] = [
'#type' => 'markup',
'#prefix' => '<div id="configured-relationships">',
'#suffix' => '</div>',
'#theme' => 'table',
'#header' => [
$this
->t('Context ID'),
$this
->t('Label'),
$this
->t('Data Type'),
$this
->t('Options'),
],
'#rows' => $this
->renderRows($cached_values),
'#empty' => $this
->t('No relationships have been added.'),
];
$form['relationships'] = [
'#type' => 'select',
'#title' => $this
->t('Add a relationship'),
'#options' => $this
->getAvailableRelationships($cached_values),
];
$form['add_relationship'] = [
'#type' => 'submit',
'#name' => 'add',
'#value' => $this
->t('Add Relationship'),
'#ajax' => [
'callback' => [
$this,
'addRelationship',
],
'event' => 'click',
],
'#submit' => [
'callback' => [
$this,
'submitForm',
],
],
];
return $form;
}