public function ParagraphsStylePlugin::validateConfigurationForm in Paragraphs Collection 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/ ParagraphsStylePlugin.php, line 233
Class
- ParagraphsStylePlugin
- Provides style selection plugin.
Namespace
Drupal\paragraphs_collection\Plugin\paragraphs\BehaviorCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
// @todo Selecting group(s) in style plugin https://www.drupal.org/node/2841304
if (empty($this->yamlStyleDiscovery
->getStyleGroups())) {
$form_state
->setErrorByName('message', $this
->t('There is no style group available, the style plugin can not be enabled.'));
}
if (!array_filter($form_state
->getValue('groups'))) {
$form_state
->setErrorByName('groups', $this
->t('The style plugin cannot be enabled if no groups are selected.'));
}
}