You are here

public function ModalForm::buildForm in Entity Reference View Widget 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/ModalForm.php, line 34
Contains \Drupal\entity_reference_view_widget\Form\ModalForm.

Class

ModalForm
Provides the database logging filter form.

Namespace

Drupal\entity_reference_view_widget\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $build_info = $form_state
    ->getBuildInfo();
  $settings = $build_info['args'][0];
  $form_state
    ->set('ervw_settings', $settings['settings']);
  $form['view'] = array(
    '#markup' => drupal_render($settings['preview']),
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['add_items'] = array(
    '#value' => t('Add items'),
    '#type' => 'button',
    '#ajax' => array(
      'callback' => array(
        get_class($this),
        'addItemsAjax',
      ),
    ),
    '#limit_validation_errors' => array(),
  );
  return $form;
}