You are here

public static function BundleFormAlter::validateTargetBundleElement in Organic groups 8

Form validate handler.

File

og_ui/src/BundleFormAlter.php, line 213

Class

BundleFormAlter
Helper for og_ui_form_alter().

Namespace

Drupal\og_ui

Code

public static function validateTargetBundleElement(array &$form, FormStateInterface $form_state) {

  // If no checkboxes were checked for 'og_target_bundles', store NULL ("all
  // bundles are referenceable") rather than empty array ("no bundle is
  // referenceable" - typically happens when all referenceable bundles have
  // been deleted).
  if ($form_state
    ->getValue('og_target_bundles') === []) {
    $form_state
      ->setValue('og_target_bundles', NULL);
  }
}