You are here

protected static function ConditionalFieldsFormHelper::formFieldGetValues in Conditional Fields 8

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

Extracts submitted field values during form validation.

Return value

array|NULL The requested field values parent. Actual field vales are stored under the key $element['#field_name'].

2 calls to ConditionalFieldsFormHelper::formFieldGetValues()
ConditionalFieldsFormHelper::evaluateDependencies in src/ConditionalFieldsFormHelper.php
Evaluate a set of dependencies for a dependent field.
ConditionalFieldsFormHelper::formValidate in src/ConditionalFieldsFormHelper.php
Validation callback for any form with conditional fields.

File

src/ConditionalFieldsFormHelper.php, line 559

Class

ConditionalFieldsFormHelper
Helper to interact with forms.

Namespace

Drupal\conditional_fields

Code

protected static function formFieldGetValues($element, FormStateInterface $form_state) {

  // Fall back to #parents to support custom dependencies.
  $parents = !empty($element['#array_parents']) ? $element['#array_parents'] : $element['#parents'];
  return NestedArray::getValue($form_state
    ->getValues(), $parents);
}