function FormController::submitForm
Same name in other branches
- 9 core/modules/system/tests/modules/condition_test/src/FormController.php \Drupal\condition_test\FormController::submitForm()
- 8.9.x core/modules/system/tests/modules/condition_test/src/FormController.php \Drupal\condition_test\FormController::submitForm()
- 10 core/modules/system/tests/modules/condition_test/src/FormController.php \Drupal\condition_test\FormController::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ system/ tests/ modules/ condition_test/ src/ FormController.php, line 81
Class
- FormController
- Routing controller class for condition_test testing of condition forms.
Namespace
Drupal\condition_testCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$subformState = SubformState::createForSubform($form['entity_bundle'], $form, $form_state);
$this->condition
->submitConfigurationForm($form['entity_bundle'], $subformState);
$subformState = SubformState::createForSubform($form['current_theme'], $form, $form_state);
$this->conditionCurrentTheme
->submitConfigurationForm($form['current_theme'], $subformState);
$config = $this->condition
->getConfig();
foreach ($config['bundles'] as $bundle) {
\Drupal::messenger()->addStatus('Bundle: ' . $bundle);
}
$article = Node::load(1);
$this->condition
->setContextValue('node', $article);
if ($this->condition
->execute()) {
\Drupal::messenger()->addStatus($this->t('Executed successfully.'));
}
if ($this->conditionCurrentTheme
->execute()) {
\Drupal::messenger()->addStatus($this->conditionCurrentTheme
->summary());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.