You are here

public function EntityHierarchy::validateConfigurationForm in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 modules/entity_hierarchy_workbench_access/src/Plugin/AccessControlHierarchy/EntityHierarchy.php \Drupal\entity_hierarchy_workbench_access\Plugin\AccessControlHierarchy\EntityHierarchy::validateConfigurationForm()

File

modules/entity_hierarchy_workbench_access/src/Plugin/AccessControlHierarchy/EntityHierarchy.php, line 337

Class

EntityHierarchy
Defines a hierarchy based on an entity hierarchy field.

Namespace

Drupal\entity_hierarchy_workbench_access\Plugin\AccessControlHierarchy

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  $settings = $form_state
    ->getValues();
  if (!array_filter($settings['boolean_fields'])) {
    $form_state
      ->setErrorByName('boolean_fields', new TranslatableMarkup('You must select at least one boolean field to enable an entity as an editorial section'));
  }
  if (!array_filter($settings['bundles'])) {
    $form_state
      ->setErrorByName('bundles', new TranslatableMarkup('You must select at least one bundle to moderate with this access scheme'));
  }
  parent::validateConfigurationForm($form, $form_state);
}