public function TestTextColorBehavior::validateConfigurationForm in Paragraphs 8
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides ParagraphsBehaviorBase::validateConfigurationForm
File
- tests/
modules/ paragraphs_test/ src/ Plugin/ paragraphs/ Behavior/ TestTextColorBehavior.php, line 40
Class
- TestTextColorBehavior
- Provides a test feature plugin.
Namespace
Drupal\paragraphs_test\Plugin\paragraphs\BehaviorCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('default_color') == 'red') {
$form_state
->setErrorByName('default_color', $this
->t('Red can not be used as the default color.'));
}
}