You are here

public static function ViewContent::viewsDisplaysAjaxCallback in Quick Tabs 8.3

Ajax callback to change views displays when view is selected.

File

src/Plugin/TabType/ViewContent.php, line 146

Class

ViewContent
Provides a 'view content' tab type.

Namespace

Drupal\quicktabs\Plugin\TabType

Code

public static function viewsDisplaysAjaxCallback(array &$form, FormStateInterface $form_state) {
  $tab_index = $form_state
    ->getTriggeringElement()['#array_parents'][2];
  $element_id = '#view-display-dropdown-' . $tab_index;
  $ajax_response = new AjaxResponse();
  $ajax_response
    ->addCommand(new ReplaceCommand($element_id, $form['configuration_data_wrapper']['configuration_data'][$tab_index]['content']['view_content']['options']['display']));
  return $ajax_response;
}