aboutsummaryrefslogtreecommitdiff
path: root/fblikebutton.handlers.inc
blob: fc5f7b3bfb92df7b941a665249adc8265877443c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

/**
 * @file
 * Contains the fblikebutton views field handler.
 */

/**
 * Field handler for fblikebutton total transactions.
 */
class fblikebutton_handler_field_fblikebutton extends views_handler_field {
  function construct() {
    parent::construct();
    $this->additional_fields['type'] = 'type';
  }
  
  function query() {
    $this->ensure_my_table();
    $this->add_additional_fields();
  }

  function render($values) {
    $output = NULL;
    $nid = $values->nid;
    $types = variable_get('fblikebutton_node_types', array());
    $show = (!empty($types[$values->node_type]) && user_access('access fblikebutton'));
    
    $conf = array(
      'layout' => variable_get('fblikebutton_layout', 'standard'),
      'action' => variable_get('fblikebutton_action', 'like'),
      'color_scheme' => variable_get('fblikebutton_color_scheme', 'light'),
      'show_faces' => variable_get('fblikebutton_show_faces', 'true'),
      'font' => variable_get('fblikebutton_font', 'arial'),
      'height' => variable_get('fblikebutton_iframe_height', '80'),
      'width' => variable_get('fblikebutton_iframe_width', '450'),
      'send' => variable_get('fblikebutton_send', 'true'),
      'other_css' => variable_get('fblikebutton_iframe_css', ''),
      'language' => variable_get('fblikebutton_language', 'en_US'),
    );
    $webpage_to_like = url("node/$nid", array('absolute' => TRUE));
    
    if ($show) {
      $output = _fblikebutton_field($webpage_to_like, $conf);
    }
    
    return $output;
  }
}