You are here

public function views_handler_field_contextual_links::render in Views (for Drupal 7) 7.3

Render the contextual fields.

Overrides views_handler_field::render

File

handlers/views_handler_field_contextual_links.inc, line 42
Definition of views_handler_field_contextual_links.

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 '';
  }
}