You are here

protected function ViewsReferenceTrait::getViewId in Views Reference Field 8

Helper function to get the current entity_id value.

The value is taken from the values array based on parent array.

Parameters

array $values: Field array.

array $parents: Element parents.

Return value

array|bool The entity id.

File

src/Plugin/Field/FieldWidget/ViewsReferenceTrait.php, line 178

Class

ViewsReferenceTrait
Trait for shared code in Viewsreference Field Widgets.

Namespace

Drupal\viewsreference\Plugin\Field\FieldWidget

Code

protected function getViewId(array $values, array $parents) {
  $key = array_shift($parents);
  $values = $values[$key];
  if ($parents) {
    $values = $this
      ->getViewId($values, $parents);
  }
  return $values;
}