You are here

private static function IframeWidgetBase::getField in Iframe 8.2

Return the field values.

Parameters

array $form: The form structure where widgets are being attached to. This might be a full form structure, or a sub-element of a larger form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array

3 calls to IframeWidgetBase::getField()
IframeWidgetBase::validateHeight in src/Plugin/Field/FieldWidget/IframeWidgetBase.php
Validate height (if minimum url is defined)
IframeWidgetBase::validateUrl in src/Plugin/Field/FieldWidget/IframeWidgetBase.php
Validate url.
IframeWidgetBase::validateWidth in src/Plugin/Field/FieldWidget/IframeWidgetBase.php
Validate width(if minimum url is defined)

File

src/Plugin/Field/FieldWidget/IframeWidgetBase.php, line 351

Class

IframeWidgetBase
Plugin implementation base functions.

Namespace

Drupal\iframe\Plugin\Field\FieldWidget

Code

private static function getField(&$form, FormStateInterface &$form_state) {
  $parents = $form['#parents'];
  $node = $form_state
    ->getUserInput();

  // Remove the field property from the list of parents.
  array_pop($parents);

  // Starting from the node drill down to the field.
  $field = $node;
  for ($i = 0; $i < count($parents); $i++) {
    $field = $field[$parents[$i]];
  }
  return $field;
}