You are here

protected function InsertViewDialog::getClientValues in Advanced Insert View 2.0.x

Same name and namespace in other branches
  1. 8 src/Form/InsertViewDialog.php \Drupal\insert_view_adv\Form\InsertViewDialog::getClientValues()

Get the values from the form required for the client.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state from the dialog submission.

Return value

array An array of values sent to the client for use in the WYSIWYG.

1 call to InsertViewDialog::getClientValues()
InsertViewDialog::ajaxSubmit in src/Form/InsertViewDialog.php
An AJAX submit callback to validate the WYSIWYG modal.

File

src/Form/InsertViewDialog.php, line 367

Class

InsertViewDialog
Class InsertViewDialog.

Namespace

Drupal\insert_view_adv\Form

Code

protected function getClientValues(FormStateInterface $form_state) {
  $view_id = '';
  $display_id = '';
  [
    $view_id,
    $display_id,
  ] = explode('=', $form_state
    ->getValue('inserted_view_adv'));
  $arguments = array_filter($form_state
    ->getValue('argument'));
  return [
    'attributes' => [
      'data-view-id' => $view_id,
      'data-display-id' => $display_id,
      'data-arguments' => implode('/', $arguments),
    ],
  ];
}