You are here

protected function ConditionalFieldsFormHelper::addStateToGroup in Conditional Fields 8

Same name and namespace in other branches
  1. 4.x src/ConditionalFieldsFormHelper.php \Drupal\conditional_fields\ConditionalFieldsFormHelper::addStateToGroup()

Merge field states to general list.

Parameters

array $state: List of field states.

array $options: Field CF settings.

1 call to ConditionalFieldsFormHelper::addStateToGroup()
ConditionalFieldsFormHelper::processDependeeFields in src/ConditionalFieldsFormHelper.php
Determine and register dependee field effects.

File

src/ConditionalFieldsFormHelper.php, line 265

Class

ConditionalFieldsFormHelper
Helper to interact with forms.

Namespace

Drupal\conditional_fields

Code

protected function addStateToGroup($state, $options) {

  // Add the $state into the correct logic group in $states.
  foreach ($state as $key => $constraints) {
    if (empty($this->states[$key][$options['grouping']])) {
      $this->states[$key][$options['grouping']] = $constraints;
    }
    else {
      $this->states[$key][$options['grouping']] = array_merge($this->states[$key][$options['grouping']], $constraints);
    }
  }
}