public function ParagraphsViewmodeBehavior::validateConfigurationForm in Paragraphs View Modes 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
- src/
Plugin/ paragraphs/ Behavior/ ParagraphsViewmodeBehavior.php, line 107
Class
- ParagraphsViewmodeBehavior
- Class ParagraphsViewmodeBehavior.
Namespace
Drupal\paragraphs_viewmode\Plugin\paragraphs\BehaviorCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::validateConfigurationForm($form, $form_state);
$default = $form_state
->getValue('override_default');
$allowed = array_filter($form_state
->getValue('override_available'));
if (!in_array($default, $allowed)) {
$form_state
->setError($form['override_default'], 'Default view mode must also be selected in allowed view modes');
}
}