Same name and namespace in other branches
  1. 8.x-3.x src/Controller/QuickTabsController.php \Drupal\quicktabs\Controller\QuickTabsController::ajaxContent()
1 string reference to 'QuickTabsController::ajaxContent'
quicktabs.routing.yml dans ./quicktabs.routing.yml
quicktabs.routing.yml

Fichier

src/Controller/QuickTabsController.php, line 57

Classe

QuickTabsController
Provides a controller for content retrieved through AJAX.

Namespace

Drupal\quicktabs\Controller

Code

public function ajaxContent($js, $instance, $tab) {
    if ($js === 'nojs') {
        return [];
    }
    else {
        $qt = $this->entityTypeManager
            ->getStorage('quicktabs_instance')
            ->load($instance);
        $configuration_data = $qt->getConfigurationData();
        $object = $this->tabTypeManager
            ->createInstance($configuration_data[$tab]['type']);
        $render = $object->render($configuration_data[$tab]);
        $element_id = '#quicktabs-tabpage-' . $instance . '-' . $tab;
        $ajax_response = new AjaxResponse();
        $ajax_response->addCommand(new HtmlCommand($element_id, $render));
        return $ajax_response;
    }
}