function views_handler_field_contextual_links::render

Render the contextual fields.

Overrides views_handler_field::render

File

handlers/views_handler_field_contextual_links.inc, line 42

Class

views_handler_field_contextual_links
Provides a handler that adds contextual links.

Code

public function render($values) {
    $links = $this->get_links();
    if (!empty($links)) {
        $build = array(
            '#prefix' => '<div class="contextual-links-wrapper">',
            '#suffix' => '</div>',
            '#theme' => 'links__contextual',
            '#links' => $links,
            '#attributes' => array(
                'class' => array(
                    'contextual-links',
                ),
            ),
            '#attached' => array(
                'library' => array(
                    array(
                        'contextual',
                        'contextual-links',
                    ),
                ),
            ),
            '#access' => user_access('access contextual links'),
        );
        return drupal_render($build);
    }
    else {
        return '';
    }
}