You are here

class addthis_handler_field_button in AddThis 6.3

@file A handler to provide an AddThis button for a particular node.

Hierarchy

Expanded class hierarchy of addthis_handler_field_button

1 string reference to 'addthis_handler_field_button'
addthis_views_data in ./addthis.views.inc
Implementation of hook_views_data().

File

./addthis_handler_field.inc, line 9
A handler to provide an AddThis button for a particular node.

View source
class addthis_handler_field_button 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);

    // 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']};
    return theme('addthis_button', NULL, array(
      'url' => url('node/' . $nid, array(
        'absolute' => TRUE,
      )),
      'title' => check_plain($title),
    ));
  }

}

Members