function views_handler_field_links::get_links

Return the list of links of this field.

Return value

array The links which are used by the render function.

2 calls to views_handler_field_links::get_links()
views_handler_field_contextual_links::render in handlers/views_handler_field_contextual_links.inc
Render the contextual fields.
views_handler_field_ctools_dropdown::render in handlers/views_handler_field_ctools_dropdown.inc
Render the dropdown button.

File

handlers/views_handler_field_links.inc, line 76

Class

views_handler_field_links
A abstract handler which provides a collection of links.

Code

public function get_links() {
    $links = array();
    foreach ($this->options['fields'] as $field) {
        if (empty($this->view->field[$field]->last_render_text)) {
            continue;
        }
        $title = $this->view->field[$field]->last_render_text;
        // Use the alter settings for the link field source not this links field.
        $alter = $this->view->field[$field]->options['alter'];
        $url = array(
            'query' => array(),
        );
        // Copy code from views_handler_field::render_as_link().
        $path = $alter['path'];
        if (!empty($path) && $path != '<front>') {
            // Leave path alone on <front> as strip_tags() would remove this.
            // Replace tokens and strip any HTML tags in the path.
            $tokens = $this->get_render_tokens(array());
            $path = strip_tags(decode_entities(strtr($path, $tokens)));
            if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
                $path = $this->case_transform($path, $alter['path_case']);
            }
            if (!empty($alter['replace_spaces'])) {
                $path = str_replace(' ', '-', $path);
            }
            $url = drupal_parse_url($path);
            if (empty($url)) {
                // Seriously malformed URLs may return FALSE or empty arrays.
                continue;
            }
            $path = $url['path'];
            // Check router menu item access for the current user.
            if ($this->options['check_access']) {
                $menu_item = menu_get_item($path);
                if (!$menu_item || empty($menu_item['access'])) {
                    continue;
                }
            }
            if (!empty($this->options['destination']) && empty($alter['external'])) {
                // Override any destination argument included in URL.
                $url['query'] = array_merge($url['query'], drupal_get_destination());
            }
            // Omit tweaks of query, fragment, and link_class.
            $alt = strtr($alter['alt'], $tokens);
            if ($alt && $alt != $title) {
                // Set the title attribute only if it improves accessibility.
                $url['attributes']['title'] = decode_entities($alt);
            }
            if (!empty($alter['rel']) && ($rel = strtr($alter['rel'], $tokens))) {
                $url['attributes']['rel'] = $rel;
            }
            $target = check_plain(trim(strtr($alter['target'], $tokens)));
            if (!empty($target)) {
                $url['attributes']['target'] = $target;
            }
        }
        $links[$field] = array(
            'href' => $path,
            'title' => $title,
        ) + $url;
    }
    return $links;
}