public function ContextEditForm::form in Context 8.4
Same name and namespace in other branches
- 8 modules/context_ui/src/Form/ContextEditForm.php \Drupal\context_ui\Form\ContextEditForm::form()
- 8.0 modules/context_ui/src/Form/ContextEditForm.php \Drupal\context_ui\Form\ContextEditForm::form()
Gets the actual form array to be built.
Overrides ContextFormBase::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- modules/
context_ui/ src/ Form/ ContextEditForm.php, line 21
Class
- ContextEditForm
- Provides a form to edit context.
Namespace
Drupal\context_ui\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
// Store contexts on the form state so that plugins can use these values
// when building their forms.
$form_state
->setTemporaryValue('gathered_contexts', $this->contextRepository
->getAvailableContexts());
$form['require_all_conditions'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Require all conditions'),
'#description' => $this
->t('If checked, all conditions must be met for this context to be active. Otherwise, the first condition that is met will activate this context.'),
'#default_value' => $this->entity
->requiresAllConditions(),
];
$form['conditions'] = [
'#prefix' => '<div id="context-conditions">',
'#suffix' => '</div>',
'#markup' => '<h3>' . $this
->t('Conditions') . '</h3>',
'#tree' => TRUE,
'#process' => [
[
$this,
'processConditions',
],
],
];
$form['reactions'] = [
'#prefix' => '<div id="context-reactions">',
'#suffix' => '</div>',
'#markup' => '<h3>' . $this
->t('Reactions') . '</h3>',
'#tree' => TRUE,
'#process' => [
[
$this,
'processReactions',
],
],
];
return $form;
}