public function ParagraphsStylePlugin::validateConfigurationForm

Overrides ParagraphsBehaviorBase::validateConfigurationForm

File

paragraphs_collection/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php, line 233

Class

ParagraphsStylePlugin
Provides style selection plugin.

Namespace

Drupal\paragraphs_collection\Plugin\paragraphs\Behavior

Code

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.'));
  }
}