aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2012-03-30 16:22:35 -0300
committerSilvio <silvio@socioambiental.org>2012-03-30 16:22:35 -0300
commit3a595d5e1243c270146d79f6917838877330ccca (patch)
treec81e44d6158d1b231c5c9a0a11eae75024b6dc21
parentedeae898f6d6bbe4fbcbe89079e1f7f7c13abf70 (diff)
downloadfblikebutton-7.x-2.x.tar.gz
fblikebutton-7.x-2.x.tar.bz2
Changing views field inspired by 10oclock's patch7.x-2.x
-rw-r--r--fblikebutton.handlers.inc63
1 files changed, 30 insertions, 33 deletions
diff --git a/fblikebutton.handlers.inc b/fblikebutton.handlers.inc
index aeb40a3..fc5f7b3 100644
--- a/fblikebutton.handlers.inc
+++ b/fblikebutton.handlers.inc
@@ -9,43 +9,40 @@
* Field handler for fblikebutton total transactions.
*/
class fblikebutton_handler_field_fblikebutton extends views_handler_field {
- /**
- * Implements views_handler_field#query().
- */
+ function construct() {
+ parent::construct();
+ $this->additional_fields['type'] = 'type';
+ }
+
function query() {
- // Provide an field alias but don't actually alter the query.
- $this->field_alias = 'views_fblikebutton_button_' . $this->position;
+ $this->ensure_my_table();
+ $this->add_additional_fields();
}
- /**
- * Renders the field.
- */
function render($values) {
- if (isset($values->nid)) {
- global $user, $base_url;
- $types = variable_get('fblikebutton_node_types', array());
- $fullnodedisplay = variable_get('fblikebutton_full_node_display', 0);
- $teaserdisplay = variable_get('fblikebutton_teaser_display', 0);
- $full = ($view_mode == 'full') ? TRUE : FALSE;
- $show = ( ! empty($types[$values->type]) && user_access('access fblikebutton'));
- // Thanks to corbacho for supplying the code for the $webpage_to_like variable...
- // (It was apparently throwing errors/notices the way I had it set up.)
- $webpage_to_like = url("node/$values->nid", array('absolute' => TRUE));
- $likebutton_weight = variable_get('fblikebutton_weight', '0');
- $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'),
- );
-
- return _fblikebutton_field($webpage_to_like, $conf);
+ $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;
}
}