function LayoutTestPlugin::validateConfigurationForm

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php \Drupal\layout_test\Plugin\Layout\LayoutTestPlugin::validateConfigurationForm()
  2. 10 core/modules/system/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php \Drupal\layout_test\Plugin\Layout\LayoutTestPlugin::validateConfigurationForm()
  3. 11.x core/modules/system/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php \Drupal\layout_test\Plugin\Layout\LayoutTestPlugin::validateConfigurationForm()

Overrides LayoutDefault::validateConfigurationForm

File

core/modules/system/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php, line 51

Class

LayoutTestPlugin
The plugin that handles the default layout template.

Namespace

Drupal\layout_test\Plugin\Layout

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    if ($form_state->getValue('setting_1') === 'Test Validation Error Message') {
        $form_state->setErrorByName('setting_1', 'Validation Error Message');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.