You are here

sheetnode_handler_field_cell.inc in Sheetnode 7

Views handler for sheetnode cells.

File

views/sheetnode_handler_field_cell.inc
View source
<?php

/**
 * @file
 * Views handler for sheetnode cells.
 */
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) {
    module_load_include('inc', 'sheetnode', 'socialcalc');
    $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;
  }

}

Classes

Namesort descending Description
sheetnode_handler_field_cell @file Views handler for sheetnode cells.