You are here

protected static function ConditionalFieldsFormHelper::formFieldGetValues in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 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 642

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