You are here

function colorbox_node_handler_field_colorbox_node_link::render_link in Colorbox Node 7.3

Same name and namespace in other branches
  1. 7.2 views/colorbox_node_handler_field_colorbox_node_link.inc \colorbox_node_handler_field_colorbox_node_link::render_link()

Apply our colorbox-node class and add our widths and heights to the query params.

Overrides views_handler_field_node_link::render_link

File

views/colorbox_node_handler_field_colorbox_node_link.inc, line 82
Views handlers for Colorbox Node module.

Class

colorbox_node_handler_field_colorbox_node_link
A handler to provide a field that is completely custom by the administrator.

Code

function render_link($node, $values) {
  if (node_access('view', $node)) {
    if (!empty($this->options['node_in_colorbox'])) {

      // If we have a rel gallery for the colorbox, lets add our rel attribute
      // and our gallery class to the link output.
      if (!empty($this->options['node_in_colorbox_rel'])) {
        $this->options['alter']['rel'] = $this->options['node_in_colorbox_rel'];
        $this->options['alter']['link_class'] = 'colorbox-node colorbox-node-gallery';
      }
      else {
        $this->options['alter']['link_class'] = 'colorbox-node';
      }
      $this->options['alter']['link_attributes']['data-inner-width'] = $this->options['node_in_colorbox_width'];
      $this->options['alter']['link_attributes']['data-inner-height'] = $this->options['node_in_colorbox_height'];
    }
  }
  return parent::render_link($node, $values);
}