You are here

public function LibraryForm::buildForm in Image Entity Browser 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

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

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/LibraryForm.php, line 34
Contains Drupal\image_browser\Form.

Class

LibraryForm
Class TestModalForm.

Namespace

Drupal\image_browser\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  //We only accept ajax request for that page
  if (false == \Drupal::request()
    ->isXmlHttpRequest()) {
    throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();
  }
  $form['library'] = array(
    views_embed_view('dexp_image_browser', 'image_browser'),
  );
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => $this
      ->t('Submit'),
    '#button_type' => 'primary',
    '#ajax' => array(
      'callback' => '::submitForm',
    ),
  );
  return $form;
}