You are here

class sheetnode_handler_field_cell in Sheetnode 6

Same name and namespace in other branches
  1. 7.2 views/sheetnode_handler_field_cell.inc \sheetnode_handler_field_cell
  2. 7 views/sheetnode_handler_field_cell.inc \sheetnode_handler_field_cell

Hierarchy

Expanded class hierarchy of sheetnode_handler_field_cell

2 string references to 'sheetnode_handler_field_cell'
sheetnode_views_data in ./sheetnode.views.inc
Implementation of hook_views_data().
sheetnode_views_data_alter in ./sheetnode.views.inc
Implementation of hook_views_data_alter().

File

views/sheetnode_handler_field_cell.inc, line 3

View source
class sheetnode_handler_field_cell extends views_handler_field {
  function option_definition() {
    $options = parent::option_definition();
    $options['reference'] = array(
      'default' => '',
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['reference'] = array(
      '#type' => 'textfield',
      '#title' => t('Cell reference'),
      '#default_value' => $this->options['reference'],
      '#description' => t('Use a cell coordinate such as A1 to refer to a specific cell.'),
    );
  }
  function render($values) {
    require_once drupal_get_path('module', 'sheetnode') . '/socialcalc.inc';
    $sheet = $values->{$this->field_alias};
    if (empty($sheet)) {
      return NULL;
    }
    $sc = socialcalc_parse_values($sheet);
    return isset($sc['cells'][$this->options['reference']]) ? $sc['cells'][$this->options['reference']]['datavalue'] : NULL;
  }

}

Members