You are here

protected function EntityBrowserForm::getCurrentWidget in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Form/EntityBrowserForm.php \Drupal\entity_browser\Form\EntityBrowserForm::getCurrentWidget()

Returns the widget that is currently selected.

Parameters

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

Return value

string ID of currently selected widget.

2 calls to EntityBrowserForm::getCurrentWidget()
EntityBrowserForm::buildForm in src/Form/EntityBrowserForm.php
Form constructor.
EntityBrowserForm::submitForm in src/Form/EntityBrowserForm.php
Form submission handler.

File

src/Form/EntityBrowserForm.php, line 262

Class

EntityBrowserForm
The entity browser form.

Namespace

Drupal\entity_browser\Form

Code

protected function getCurrentWidget(FormStateInterface $form_state) {

  // Do not use has() as that returns TRUE if the value is NULL.
  if (!$form_state
    ->get('entity_browser_current_widget')) {
    $form_state
      ->set('entity_browser_current_widget', $this->entityBrowser
      ->getFirstWidget());
  }
  return $form_state
    ->get('entity_browser_current_widget');
}