Same name in other branches
  1. 8.x-1.x src/Plugin/QuickContent/QuickViewContent.php \Drupal\quicktabs\Plugin\QuickContent\QuickViewContent::__construct()

Overrides QuickContent::__construct

File

plugins/QuickViewContent.inc, line 60

Class

QuickViewContent
Class for tab content of type "view" - this is for rendering a view as tab content.

Code

public function __construct($item) {
    parent::__construct($item);
    if (module_exists('views')) {
        views_add_js('ajax_view');
    }
    $this->settings['view_path'] = rawurlencode($_GET['q']);
    $this->settings['view_dom_id'] = self::$view_dom_id++;
    $args_array = array();
    $ajax_args = '';
    if (isset($item['args'])) {
        $url_args = arg();
        $args = $item['args'];
        foreach ($url_args as $id => $arg) {
            $args = str_replace("%{$id}", $arg, $args);
        }
        $args = preg_replace(',/?(%\\d),', '', $args);
        if (!empty($args)) {
            $ajax_args = rawurlencode($args);
            $args_array = explode('/', $args);
        }
    }
    $this->settings['ajax_args'] = $ajax_args;
    $this->settings['actual_args'] = $args_array;
}