Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 42 lines (36 sloc) 1.267 kb
be392121 » kwcoffman
2011-08-26 Initial commit of the open_badges version
1 <?php
2 /**
3 * @file
4 * A handler to provide proper displays for individual user badges.
5 *
6 * @author Richard Skinner (Likeless), http://drupal.org/user/310635
7 *
8 * @ingroup views_field_handlers
9 */
10 class views_handler_field_open_badges_badges_badge extends views_handler_field {
11
12 //Get the additional fields we need
13 function construct() {
14 parent::construct();
15 $this->additional_fields['name'] = 'name';
16 $this->additional_fields['image'] = 'image';
17 $this->additional_fields['criteria'] = 'criteria';
18 $this->additional_fields['weight'] = 'weight';
19 }
20
21 //Add the additional fields to the query
22 function query() {
23 $this->ensure_my_table();
24 $this->add_additional_fields();
25 }
26
27 //Render the badge HTML
28 function render($values) {
ca4744ae » kwcoffman
2011-10-07 Standardize on dpm() and make all the commented meesages consistent
29 //dpm("views_handler_field_open_badges_badges_badge: render(): entered");
be392121 » kwcoffman
2011-08-26 Initial commit of the open_badges version
30 //create the badge object
31 $badge->bid = $values->{$this->field_alias};
32 $badge->name = $values->{$this->aliases['name']};
33 $badge->image = $values->{$this->aliases['image']};
34 $badge->criteria = $values->{$this->aliases['criteria']};
35 $badge->weight = $values->{$this->aliases['weight']};
36
37 //Send it through the standard theme and return it
38 return theme('open_badge', $badge);
39 }
40
41
42 }
Something went wrong with that request. Please try again.