You are here

public function EntityBrowserFormTrait::getEntityBrowserValue in Helper 8

Gets the entity browser form value.

Parameters

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

array|string $parents: The parents of the containing form element.

Return value

array The entity browser value.

File

src/EntityBrowserFormTrait.php, line 124

Class

EntityBrowserFormTrait
Provides helpers for adding an entity browser element to a form.

Namespace

Drupal\helper

Code

public function getEntityBrowserValue(FormStateInterface $form_state, $parents) {
  $parents = is_array($parents) ? $parents : [
    $parents,
  ];
  return $form_state
    ->getValue(array_merge($parents, [
    'browser',
    'entity_ids',
  ]));
}