class addthis_handler_field_toolbox in AddThis 6.3
A handler to provide an AddThis toolbox for a particular node.
Hierarchy
- class \addthis_handler_field_toolbox extends \views_handler_field
Expanded class hierarchy of addthis_handler_field_toolbox
1 string reference to 'addthis_handler_field_toolbox'
- addthis_views_data in ./
addthis.views.inc - Implementation of hook_views_data().
File
- ./
addthis_handler_field.inc, line 52 - A handler to provide an AddThis button for a particular node.
View source
class addthis_handler_field_toolbox extends views_handler_field {
function construct() {
parent::construct();
$this->additional_fields['nid'] = 'nid';
$this->additional_fields['title'] = 'title';
}
function query() {
$this
->ensure_my_table();
$this
->add_additional_fields();
}
function option_definition() {
$options = parent::option_definition();
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Allow for custom toolbox services.
$form['services'] = array(
'#type' => 'textarea',
'#rows' => 3,
'#title' => t('Toolbox services'),
'#description' => t('A comma-separated list of AddThis service codes to use in the Toolbox field. Leave blank to use your configured defaults.'),
'#default_value' => $this->options['services'],
);
// Alter options form defaults.
unset($form['alter']);
unset($form['empty']);
unset($form['empty_zero']);
unset($form['hide_empty']);
}
function render($values) {
$nid = $values->{$this->aliases['nid']};
$title = $values->{$this->aliases['title']};
$services = !empty($this->options['services']) ? $this->options['services'] : NULL;
return theme('addthis_toolbox', $services, array(
'url' => url('node/' . $nid, array(
'absolute' => TRUE,
)),
'title' => check_plain($title),
));
}
}