function views_plugin_display::render_more_link

Render the 'more' link.

File

plugins/views_plugin_display.inc, line 2717

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

public function render_more_link() {
    if ($this->use_more() && ($this->use_more_always() || !empty($this->view->query->pager) && $this->view->query->pager
        ->has_more_records())) {
        $path = $this->get_path();
        if ($this->get_option('link_display') == 'custom_url' && ($override_path = $this->get_option('link_url'))) {
            $tokens = $this->get_arguments_tokens();
            $path = strtr($override_path, $tokens);
        }
        if ($path) {
            if (empty($override_path)) {
                $path = $this->view
                    ->get_url(NULL, $path);
            }
            $url_options = array();
            if (!empty($this->view->exposed_raw_input)) {
                $url_options['query'] = $this->view->exposed_raw_input;
            }
            $theme = views_theme_functions('views_more', $this->view, $this->display);
            $parsed_url = drupal_parse_url($path);
            // Preserve the query string from url.
            if (!empty($parsed_url['query'])) {
                if (!empty($url_options['query'])) {
                    $url_options['query'] = array_merge($parsed_url['query'], $url_options['query']);
                }
                else {
                    $url_options['query'] = $parsed_url['query'];
                }
                $path = $parsed_url['path'];
            }
            // Add fragment if applicable.
            if (!empty($parsed_url['fragment'])) {
                $url_options['fragment'] = $parsed_url['fragment'];
            }
            $path = check_url(url($path, $url_options));
            return theme($theme, array(
                'more_url' => $path,
                'new_window' => $this->use_more_open_new_window(),
                'link_text' => check_plain($this->use_more_text()),
                'view' => $this->view,
            ));
        }
    }
}