You are here

protected function ViewPreviewForm::actions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/ViewPreviewForm.php \Drupal\views_ui\ViewPreviewForm::actions()

Returns an array of supported actions for the current entity form.

@todo Consider introducing a 'preview' action here, since it is used by many entity types.

Overrides EntityForm::actions

File

core/modules/views_ui/src/ViewPreviewForm.php, line 78
Contains \Drupal\views_ui\ViewPreviewForm.

Class

ViewPreviewForm
Form controller for the Views preview form.

Namespace

Drupal\views_ui

Code

protected function actions(array $form, FormStateInterface $form_state) {
  $view = $this->entity;
  return array(
    '#attributes' => array(
      'id' => 'preview-submit-wrapper',
      'class' => array(
        'preview-submit-wrapper',
      ),
    ),
    'button' => array(
      '#type' => 'submit',
      '#value' => $this
        ->t('Update preview'),
      '#attributes' => array(
        'class' => array(
          'arguments-preview',
        ),
      ),
      '#submit' => array(
        '::submitPreview',
      ),
      '#id' => 'preview-submit',
      '#ajax' => array(
        'url' => Url::fromRoute('entity.view.preview_form', [
          'view' => $view
            ->id(),
          'display_id' => $this->displayID,
        ]),
        'wrapper' => 'views-preview-wrapper',
        'event' => 'click',
        'progress' => array(
          'type' => 'fullscreen',
        ),
        'method' => 'replaceWith',
        'disable-refocus' => TRUE,
      ),
    ),
  );
}