You are here

class sheetnode_plugin_style in Sheetnode 7

Same name and namespace in other branches
  1. 6 views/sheetnode_plugin_style.inc \sheetnode_plugin_style
  2. 7.2 views/sheetnode_plugin_style.inc \sheetnode_plugin_style

Hierarchy

Expanded class hierarchy of sheetnode_plugin_style

1 string reference to 'sheetnode_plugin_style'
sheetnode_views_plugins in ./sheetnode.views.inc
Implements hook_views_plugins().

File

views/sheetnode_plugin_style.inc, line 12

View source
class sheetnode_plugin_style extends views_plugin_style {
  function option_definition() {
    $options = parent::option_definition();
    $options['expansion'] = array(
      'default' => SHEETNODE_EXPANSION_VERTICAL,
    );
    $options['use_template'] = array(
      'default' => FALSE,
    );
    $options['template'] = array(
      'default' => '',
    );
    return $options;
  }
  function options_form(&$form, &$form_values) {
    parent::options_form($form, $form_values);
    $form['expansion'] = array(
      '#type' => 'radios',
      '#title' => t('Expansion of results'),
      '#description' => t('You can specify whether view results should be expanded horizontally or vertically.'),
      '#options' => array(
        SHEETNODE_EXPANSION_VERTICAL => t('Consecutive rows'),
        SHEETNODE_EXPANSION_HORIZONTAL => t('Consecutive columns'),
      ),
      '#default_value' => $this->options['expansion'],
      '#weight' => 97,
    );
    $form['use_template'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use template'),
      '#description' => t('Check this box to use the spreadsheet below as template for your view.
                           To place view results in the template, use the following syntax in the cells:
                           <ul>
                           <li><code>${field_label}</code> to indicate that this cell and subsequent ones should be filled with values of this field.</li>
                           <li><code>${FUNCTION(@field_label@, $field_label$, @cell_reference@, ...)}</code> to indicate that this cell and subsequent ones should be filled with a calculation.
                           <code>@field_label@</code> are replaced with the corresponding cell references, and <code>$field_label$</code> are replaced with actual field values.</li>
                           <li><code>$[FUNCTION(@field_label@, @cell_reference@, ...)]</code> to indicate that a calculation should be placed in this cell.
                           <code>@field_label@</code> are replaced with the corresponding cell ranges.</li>
                           </ul>'),
      '#default_value' => $this->options['use_template'],
      '#weight' => 98,
    );
    $id = 'edit-style-options-template';
    $form['template'] = array(
      '#type' => 'hidden',
      '#attributes' => array(
        'id' => $id,
      ),
      '#weight' => 99,
    );
    $this
      ->render_inject($this->options['template'], $id, $form['template'], '#prefix');
  }
  function render_sheet() {
    $tangent = $this->options['expansion'];
    $normal = 1 - $tangent;
    if ($this->options['use_template']) {
      $socialcalc = socialcalc_parse($this->options['template']);
      $lastpos = array(
        0,
        0,
      );

      // Iterate through cells, gathering placeholder values.
      if (!empty($socialcalc['sheet']['cells'])) {
        foreach ($socialcalc['sheet']['cells'] as $coord => $cell) {

          // Field placeholder?
          $matches = array();
          if (isset($cell['datavalue']) && $cell['datatype'] == 't') {
            if (preg_match('/^\\${(.*?)\\}$/', $cell['datavalue'], $matches)) {
              $field_name = $this
                ->find_field($matches[1]);
              if (isset($cell['comment']) && preg_match('/^\\${(.*?)\\}$/', $cell['comment'], $comment_matches)) {
                $comment_field_name = $this
                  ->find_field($comment_matches[1]);
              }
              else {
                $comment_field_name = FALSE;
              }
              if ($field_name && !$this->view->field[$field_name]->options['exclude']) {

                // it's a field expansion
                $fields[$field_name] = array(
                  'coord' => $coord,
                  'cell' => $cell,
                  'info' => $this->view->field[$field_name],
                  'comment' => $comment_field_name,
                );
              }
              else {

                // it's a formula expansion
                $formula_expansions[] = array(
                  'coord' => $coord,
                  'cell' => $cell,
                  'expression' => $matches[1],
                  'comment' => $comment_field_name,
                );
              }
            }
            else {
              if (preg_match('/^\\$\\[(.*?)]$/', $cell['datavalue'], $matches)) {

                // it's a formula placement
                $formulas[] = array(
                  'coord' => $coord,
                  'cell' => $cell,
                  'expression' => $matches[1],
                );
              }
            }
          }
          $lastpos = array(
            max($lastpos[0], $cell['pos'][0]),
            max($lastpos[1], $cell['pos'][1]),
          );
        }
      }

      // Replace field placeholders with actual values.
      $tangent_increment = array(
        SHEETNODE_EXPANSION_VERTICAL => 0,
        SHEETNODE_EXPANSION_HORIZONTAL => 1,
      );
      if (!empty($fields)) {
        foreach ($fields as $field_name => $field) {
          unset($socialcalc['sheet']['cells'][$field['coord']]);
          $newcell = $field['cell'];
          $pos = $maxpos = $newcell['pos'];
          $this->view->row_index = 0;
          foreach ($this->view->result as $j => $result) {
            $this->view->row_index = $j;

            // Get comment value if any.
            if ($field['comment']) {
              $comment_field = $this->view->field[$field['comment']];
              $newcell['comment'] = strip_tags($comment_field
                ->theme($result));
            }

            // Get cell value.
            $value = $field['info']
              ->theme($result);
            if (is_array($value)) {

              // Expand an array of values into consecutive cells.
              $itempos = $pos;
              foreach ($value as $item) {
                $itemcell = $newcell;
                $itemcell['pos'] = $itempos;
                $itemcell['datavalue'] = $item;
                $itemcell['datatype'] = is_numeric($item) ? 'v' : 't';
                $itemcell['valuetype'] = is_numeric($item) ? 'n' : 'th';
                $newcells[socialcalc_cr_to_coord($itempos[0], $itempos[1])] = $itemcell;
                $itempos[$tangent]++;
                $maxpos[$tangent] = max($maxpos[$tangent], $itempos[$tangent]);
              }
            }
            else {

              // Expand a single value into the current cell.
              $newcell['pos'] = $pos;
              $newcell['datavalue'] = $value;
              $newcell['datatype'] = is_numeric($value) ? 'v' : 't';
              $newcell['valuetype'] = is_numeric($value) ? 'n' : 'th';
              $newcells[socialcalc_cr_to_coord($pos[0], $pos[1])] = $newcell;
            }
            $pos[$normal]++;
          }
          $maxpos[$normal] = $pos[$normal];
          $fields[$field_name]['endpos'] = array(
            $maxpos[0] - $tangent_increment[$tangent],
            $maxpos[1] - $tangent_increment[$normal],
          );
          $lastpos = array(
            max($lastpos[0], $maxpos[0]),
            max($lastpos[1], $maxpos[1]),
          );
        }
      }

      // Replace formula expansions with actual values.
      if (!empty($formula_expansions) && !empty($fields)) {
        foreach ($formula_expansions as $fe) {
          unset($socialcalc['sheet']['cells'][$fe['coord']]);
          $newcell = $fe['cell'];
          $pos = $newcell['pos'];
          $matches = array();
          $count = preg_match_all('/@(.*?)@|\\$(.*?)\\$/', $fe['expression'], $matches);
          $this->view->row_index = 0;
          foreach ($this->view->result as $j => $result) {
            $this->view->row_index = $j;

            // Get comment value if any.
            if ($fe['comment']) {
              $comment_field = $this->view->field[$fe['comment']];
              $newcell['comment'] = strip_tags($comment_field
                ->theme($result));
            }

            // Expand formula.
            $expression = $fe['expression'];
            $newcell['pos'] = $pos;
            for ($i = 0; $i < $count; $i++) {
              $replace = NULL;
              $match = !empty($matches[1][$i]) ? $matches[1][$i] : $matches[2][$i];
              $field_name = $this
                ->find_field($match);
              if (!$field_name) {

                // Not a field: try a cell coordinate.
                if (preg_match('/^\\$?\\w\\w?\\$?\\d+$/', $match)) {
                  $refpos = socialcalc_coord_to_cr($match);
                  foreach ($fields as $field) {
                    if ($refpos == $field['cell']['pos']) {
                      $replace = socialcalc_cr_to_coord($field['cell']['pos'][0] + $j * $tangent_increment[$tangent], $field['cell']['pos'][1] + $j * $tangent_increment[$normal]);
                      break;
                    }
                  }
                }
              }
              else {
                if ($matches[0][$i][0] == '@' && isset($fields[$field_name])) {
                  $replace = socialcalc_cr_to_coord($fields[$field_name]['cell']['pos'][0] + $j * $tangent_increment[$tangent], $fields[$field_name]['cell']['pos'][1] + $j * $tangent_increment[$normal]);
                }
                else {
                  if ($matches[0][$i][0] == '$') {
                    $field = $this->view->field[$field_name];
                    $replace = $field
                      ->get_value($result);

                    // Special case: empty array == NULL.
                    if (is_array($replace) && empty($replace)) {
                      $replace = NULL;
                    }
                    else {
                      if (!is_scalar($replace) && isset($field->field_info) && isset($result->_field_data[$field->field_alias])) {
                        $field_data = $result->_field_data[$field->field_alias];
                        $output = '';
                        foreach ($replace as $item) {
                          $element = field_view_value($field_data['entity_type'], $field_data['entity'], $field_name, $item);
                          $output .= drupal_render($element);
                        }
                        $replace = $output;
                      }
                    }
                  }
                }
              }
              if (!is_null($replace)) {
                $expression = str_replace($matches[0][$i], $replace, $expression);
              }
              else {
                $expression = NULL;
              }
            }
            if (!is_null($expression)) {
              $newcell['formula'] = $expression;
              $newcell['datatype'] = 'f';
              $newcell['valuetype'] = 'n';
              $newcell['datavalue'] = 0;
              $newcells[socialcalc_cr_to_coord($pos[0], $pos[1])] = $newcell;
            }
            $pos[$normal]++;
          }
          $fields[] = array(
            'cell' => $fe['cell'],
            'coord' => $fe['coord'],
            'endpos' => array(
              $pos[0] - $tangent_increment[$tangent],
              $pos[1] - $tangent_increment[$normal],
            ),
          );
          $lastpos = array(
            max($lastpos[0], $pos[0]),
            max($lastpos[1], $pos[1]),
          );
        }
      }

      // Replace formula placeholders with actual values.
      if (!empty($formulas)) {
        foreach ($formulas as $formula) {
          $newcell = $formula['cell'];
          $expression = $formula['expression'];
          $matches = array();
          $count = (int) preg_match_all('/@(.*?)@/', $expression, $matches);
          for ($i = 0; $i < $count; $i++) {
            $field_name = $this
              ->find_field($matches[1][$i]);
            if (!$field_name || !isset($fields[$field_name])) {

              // Not a field: try a cell coordinate.
              if (preg_match('/^\\$?\\w\\w?\\$?\\d+$/', $matches[1][$i])) {
                $replace = '@' . $matches[1][$i] . '@';
                $references[$formula['coord']][] = socialcalc_coord_to_cr(str_replace('$', '', $matches[1][$i]));
              }
              else {
                $replace = NULL;
              }
            }
            else {
              $field = $fields[$field_name];
              $replace = socialcalc_cr_to_coord($field['cell']['pos'][0], $field['cell']['pos'][1]) . ':' . socialcalc_cr_to_coord($field['endpos'][0], $field['endpos'][1]);
            }
            if (!is_null($replace)) {
              $expression = str_replace($matches[0][$i], $replace, $expression);
            }
            else {
              $expression = NULL;
            }
          }
          if (!is_null($expression)) {
            $newcell['formula'] = $expression;
            $newcell['datatype'] = 'f';
            $newcell['valuetype'] = 'n';
            $newcell['datavalue'] = 0;
            $socialcalc['sheet']['cells'][$formula['coord']] = $newcell;
          }
        }
      }

      // Adjust positions of all cells based on expanded values.
      if (!empty($fields)) {
        foreach ($socialcalc['sheet']['cells'] as $coord => $cell) {
          $pos = $cell['pos'];
          foreach ($fields as $field) {
            if ($pos[$tangent] == $field['cell']['pos'][$tangent] && $pos[$normal] > $field['cell']['pos'][$normal]) {
              $pos[$normal] += $field['endpos'][$normal] - $field['cell']['pos'][$normal];
              unset($socialcalc['sheet']['cells'][$coord]);
              $cell['pos'] = $pos;
              $newcoord = socialcalc_cr_to_coord($pos[0], $pos[1]);
              $socialcalc['sheet']['cells'][$newcoord] = $cell;
              if (isset($references[$coord])) {
                $references[$newcoord] = $references[$coord];
                unset($references[$coord]);
              }
              $lastpos = array(
                max($lastpos[0], $pos[0]),
                max($lastpos[1], $pos[1]),
              );
              break;
            }
          }
        }
      }

      // Adjust references in formulas based on expanded values.
      if (!empty($fields) && !empty($references)) {
        foreach ($references as $coord => $positions) {
          $cell = $socialcalc['sheet']['cells'][$coord];
          $expression = $cell['formula'];
          $matches = array();
          $count = (int) preg_match_all('/@\\$?\\w\\w?\\$?\\d+@/', $expression, $matches);
          for ($i = 0; $i < $count; $i++) {
            $pos = $positions[$i];
            foreach ($fields as $field) {
              if ($pos[$tangent] == $field['cell']['pos'][$tangent]) {
                if ($pos[$normal] == $field['cell']['pos'][$normal]) {

                  // referencing a field cell
                  $refrange = socialcalc_cr_to_coord($field['cell']['pos'][0], $field['cell']['pos'][1]) . ':' . socialcalc_cr_to_coord($field['endpos'][0], $field['endpos'][1]);
                  $expression = str_replace($matches[0][$i], $refrange, $expression);
                  break;
                }
                else {
                  if ($pos[$normal] > $field['cell']['pos'][$normal]) {

                    // referencing a cell below a field
                    $pos[$normal] += $field['endpos'][$normal] - $field['cell']['pos'][$normal];
                    $refcoord = socialcalc_cr_to_coord($pos[0], $pos[1], TRUE);
                    $expression = preg_replace('/@(\\$?)\\w\\w?(\\$?)\\d+@/', '${1}' . $refcoord[0] . '${2}' . $refcoord[1], $expression, 1);
                    break;
                  }
                }
              }
            }
          }
          $cell['formula'] = $expression;
          $socialcalc['sheet']['cells'][$coord] = $cell;
        }
      }

      // Replace values inside the sheet.
      if (!empty($newcells)) {
        $socialcalc['sheet']['cells'] += $newcells;
      }
      $socialcalc['sheet']['attribs']['lastcol'] = $lastpos[0];
      $socialcalc['sheet']['attribs']['lastrow'] = $lastpos[1];

      // Adjust starting cell in editor.
      $pos = $socialcalc['edit']['ecell']['pos'];
      if (!empty($fields)) {
        foreach ($fields as $field) {
          if ($pos[$tangent] == $field['cell']['pos'][$tangent] && $pos[$normal] > $field['cell']['pos'][$normal]) {
            $pos[$normal] += $field['endpos'][$normal] - $field['cell']['pos'][$normal];
            $ecell_changed = TRUE;
            break;
          }
        }
      }
      $socialcalc['edit']['ecell']['pos'] = $pos;
      $socialcalc['edit']['ecell']['coord'] = socialcalc_cr_to_coord($pos[0], $pos[1]);

      // Adjust row and column panes.
      $panes = $tangent == SHEETNODE_EXPANSION_VERTICAL ? 'rowpanes' : 'colpanes';
      foreach ($socialcalc['edit'][$panes] as $i => $pane) {
        $delta = 0;
        if (!empty($fields)) {
          foreach ($fields as $field) {
            if ($pane['last'] > $field['cell']['pos'][$normal]) {
              $delta = max($delta, $field['endpos'][$normal] - $field['cell']['pos'][$normal]);
            }
          }
        }
        if (!empty($ecell_changed)) {
          $socialcalc['edit'][$panes][$i]['first'] += $delta;
          $socialcalc['edit'][$panes][$i]['last'] += $delta;
        }
      }
    }
    else {

      // Hand-make default SocialCalc structure based on views results.
      $pos = array(
        1,
        1,
      );
      foreach ($this->view->field as $field => $info) {
        if ($info->options['exclude']) {
          continue;
        }
        $cell['pos'] = $pos;
        $cell['datavalue'] = $info
          ->label();
        $cell['datatype'] = 't';
        $cell['valuetype'] = 't';
        $sheet['cells'][socialcalc_cr_to_coord($pos[0], $pos[1])] = $cell;
        $pos[$tangent]++;
      }
      $pos[$normal] = 2;
      $this->view->row_index = 0;
      foreach ($this->view->result as $j => $result) {
        $this->view->row_index = $j;
        $pos[$tangent] = 1;
        foreach ($this->view->field as $field => $info) {
          if ($info->options['exclude']) {
            continue;
          }
          $value = $info
            ->theme($result);
          if (is_array($value)) {
            foreach ($value as $item) {
              $cell['pos'] = $pos;
              $cell['datavalue'] = $item;
              $cell['datatype'] = is_numeric($item) ? 'v' : 't';
              $cell['valuetype'] = is_numeric($item) ? 'n' : 'th';
              $sheet['cells'][socialcalc_cr_to_coord($pos[0], $pos[1])] = $cell;
              $pos[$tangent]++;
            }
          }
          else {
            $cell['pos'] = $pos;
            $cell['datavalue'] = $value;
            $cell['datatype'] = is_numeric($value) ? 'v' : 't';
            $cell['valuetype'] = is_numeric($value) ? 'n' : 'th';
            $sheet['cells'][socialcalc_cr_to_coord($pos[0], $pos[1])] = $cell;
            $pos[$tangent]++;
          }
        }
        $pos[$normal]++;
      }
      $sheet['attribs']['lastcol'] = $pos[0] - 1;
      $sheet['attribs']['lastrow'] = $pos[1] - 1;
      if ($tangent == SHEETNODE_EXPANSION_VERTICAL) {
        $edit['rowpanes'] = array(
          0 => array(
            'first' => 1,
            'last' => 1,
          ),
          1 => array(
            'first' => 2,
            'last' => $sheet['attribs']['lastrow'],
          ),
        );
        $edit['colpanes'] = array(
          0 => array(
            'first' => 1,
            'last' => $sheet['attribs']['lastcol'],
          ),
        );
      }
      else {
        $edit['colpanes'] = array(
          0 => array(
            'first' => 1,
            'last' => 1,
          ),
          1 => array(
            'first' => 2,
            'last' => $sheet['attribs']['lastcol'],
          ),
        );
        $edit['rowpanes'] = array(
          0 => array(
            'first' => 1,
            'last' => $sheet['attribs']['lastrow'],
          ),
        );
      }
      $edit['ecell'] = array(
        'coord' => 'A1',
      );

      // Inject the Sheetnode code.
      $socialcalc = array(
        'sheet' => $sheet,
        'edit' => $edit,
        'audit' => socialcalc_default_audit($sheet),
      );
    }

    // Merge with saved version if any.
    $this
      ->merge_annotation($socialcalc);
    unset($this->view->row_index);
    return $socialcalc;
  }
  function merge_annotation(&$original) {
    $annotation = db_query("SELECT value FROM {sheetnode_view} WHERE view_name = :name AND display_id = :id", array(
      ':name' => $this->view->name,
      ':id' => $this->view->display_handler->display->id,
    ))
      ->fetchField();
    if ($annotation) {
      $merge = socialcalc_parse($annotation);

      // TODO - This is the wrong way to merge, because annotations will wind up
      // on the wrong rows if the view contains new records or is sorted differently.
      // What's needed is to associate each row with a record id to match them up when merging.
      foreach ($merge['sheet']['cells'] as $coord => $cell) {
        if (empty($original['sheet']['cells'][$coord])) {
          $original['sheet']['cells'][$coord] = $cell;

          // TODO - Import annotation styles into original.
        }
      }

      // Adjust lastcol and lastrow.
      $original['sheet']['attribs']['lastcol'] = max($original['sheet']['attribs']['lastcol'], $merge['sheet']['attribs']['lastcol']);
      $original['sheet']['attribs']['lastrow'] = max($original['sheet']['attribs']['lastrow'], $merge['sheet']['attribs']['lastrow']);
    }
  }
  function render_inject($value, $save_element, &$element, $attribute) {
    $library_path = drupal_get_path('module', 'sheetnode');
    $module_path = drupal_get_path('module', 'sheetnode');
    $context = array(
      'entity-type' => 'view',
      'oid' => $this->view->name,
    );
    $sheet_id = drupal_clean_css_identifier('sheetview-' . $this->view->name . (empty($this->view->live_preview) ? '' : '-preview'));
    $setting = array(
      'sheetnode' => array(
        $sheet_id => array(
          'aliases' => array(
            $this->view->name,
          ),
          'value' => $value,
          'imagePrefix' => base_path() . $library_path . '/socialcalc/images/sc-',
          'containerElement' => $sheet_id,
          'saveElement' => $save_element,
          'viewMode' => variable_get('sheetnode_view_mode', SHEETNODE_VIEW_FIDDLE),
          'showToolbar' => variable_get('sheetnode_view_toolbar', FALSE),
          'permissions' => array(
            'edit sheetnode settings' => user_access('edit sheetnode settings'),
          ),
          'context' => $context,
        ),
      ),
    );
    $element[$attribute] = '<div class="sheetview" id="' . $sheet_id . '"></div>';
    $element['#attached']['js'] = array(
      $library_path . '/socialcalc/formatnumber2.js',
      array(
        'weight' => 1,
      ),
      $library_path . '/socialcalc/formula1.js',
      array(
        'weight' => 2,
      ),
      $library_path . '/socialcalc/socialcalcconstants.js',
      array(
        'weight' => 3,
      ),
      $library_path . '/socialcalc/socialcalc-3.js',
      array(
        'weight' => 4,
      ),
      $library_path . '/socialcalc/socialcalctableeditor.js',
      array(
        'weight' => 5,
      ),
      $library_path . '/socialcalc/socialcalcpopup.js',
      array(
        'weight' => 6,
      ),
      $library_path . '/socialcalc/socialcalcspreadsheetcontrol.js',
      array(
        'weight' => 7,
      ),
      $library_path . '/socialcalc/socialcalcviewer.js',
      array(
        'weight' => 8,
      ),
      $module_path . '/js/sheetnode.js',
      array(
        'weight' => 9,
      ),
      array(
        'data' => $setting,
        'type' => 'setting',
      ),
    );
    $element['#attached']['css'] = array(
      $library_path . '/socialcalc/socialcalc.css',
      $module_path . '/css/sheetnode.css',
    );
    module_invoke_all('sheetnode_plugins', $value, $save_element, $context);
  }
  function render() {
    foreach ($this->view->field as $field => $info) {

      // Don't render here if we're making an editable spreadsheet view.
      if ($info instanceof sheetnode_handler_field_editable) {
        return;
      }
    }
    $value = socialcalc_save($this
      ->render_sheet());
    $element = array();
    $this
      ->render_inject($value, FALSE, $element, '#markup');
    return $element;
  }
  function find_field($field_name) {
    if (isset($this->view->field[$field_name])) {
      return $field_name;
    }
    foreach ($this->view->field as $field => $info) {
      if ($info->field_alias == $field_name) {
        return $field;
      }
      if (strcasecmp($info
        ->label(), $field_name) == 0) {
        return $field;
      }
      if (method_exists($info, 'ui_name') && strcasecmp($info
        ->ui_name(), $field_name) == 0) {
        return $field;
      }
    }
    return FALSE;
  }
  function attach_to($display_id, $path, $title) {
    $url_options = array(
      'html' => TRUE,
    );
    $input = $this->view
      ->get_exposed_input();
    if ($input) {
      $url_options['query'] = $input;
    }
    $image = theme('image', array(
      'path' => $this->feed_image,
    ));
    $this->view->feed_icon .= l($image, $this->view
      ->get_url(NULL, $path), $url_options);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
sheetnode_plugin_style::attach_to function 1
sheetnode_plugin_style::find_field function
sheetnode_plugin_style::merge_annotation function
sheetnode_plugin_style::options_form function Provide a form to edit options for this plugin. Overrides views_plugin_style::options_form 1
sheetnode_plugin_style::option_definition function Information about options for all kinds of purposes will be held here. Overrides views_plugin_style::option_definition 1
sheetnode_plugin_style::render function Render the display in this style. Overrides views_plugin_style::render 2
sheetnode_plugin_style::render_inject function
sheetnode_plugin_style::render_sheet function
views_object::$definition public property Handler's definition.
views_object::$options public property Except for displays, options for the object will be held here. 1
views_object::altered_option_definition function Collect this handler's option definition and alter them, ready for use.
views_object::construct public function Views handlers use a special construct function. 4
views_object::export_option public function 1
views_object::export_options public function
views_object::export_option_always public function Always exports the option, regardless of the default value.
views_object::options Deprecated public function Set default options on this object. 1
views_object::set_default_options public function Set default options.
views_object::set_definition public function Let the handler know what its full definition is.
views_object::unpack_options public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable public function Unpack a single option definition.
views_object::unpack_translatables public function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults public function
views_plugin::$display public property The current used views display.
views_plugin::$plugin_name public property The plugin name of this plugin, for example table or full.
views_plugin::$plugin_type public property The plugin type of this plugin, for example style or query.
views_plugin::$view public property The top object of a view. Overrides views_object::$view 1
views_plugin::additional_theme_functions public function Provide a list of additional theme functions for the theme info page.
views_plugin::options_submit public function Handle any special handling on the validate form. 9
views_plugin::plugin_title public function Return the human readable name of the display.
views_plugin::summary_title public function Returns the summary of the settings in the display. 8
views_plugin::theme_functions public function Provide a full list of possible theme templates used by this style.
views_plugin_style::$row_plugin public property The row plugin, if it's initialized and the style itself supports it.
views_plugin_style::$row_tokens public property Store all available tokens row rows.
views_plugin_style::build_sort public function Called by the view builder to see if this style handler wants to interfere with the sorts. If so it should build; if it returns any non-TRUE value, normal sorting will NOT be added to the query. 1
views_plugin_style::build_sort_post public function Called by the view builder to let the style build a second set of sorts that will come after any other sorts in the view. 1
views_plugin_style::destroy public function Destructor. Overrides views_object::destroy
views_plugin_style::even_empty public function Should the output of the style plugin be rendered even if it's empty. 1
views_plugin_style::get_field public function Get a rendered field.
views_plugin_style::get_field_value public function Get the raw field value.
views_plugin_style::get_row_class public function Return the token replaced row class for the specified row.
views_plugin_style::init public function Initialize a style plugin.
views_plugin_style::options_validate public function Validate the options form. Overrides views_plugin::options_validate
views_plugin_style::pre_render public function Allow the style to do stuff before each row is rendered.
views_plugin_style::query public function Add anything to the query that we might need to. Overrides views_plugin::query 2
views_plugin_style::render_fields public function Render all of the fields for a given style and store them on the object.
views_plugin_style::render_grouping public function Group records as needed for rendering.
views_plugin_style::render_grouping_sets public function Render the grouping sets.
views_plugin_style::tokenize_value public function Take a value and apply token replacement logic to it.
views_plugin_style::uses_fields public function Return TRUE if this style also uses fields.
views_plugin_style::uses_row_class public function Return TRUE if this style also uses a row plugin.
views_plugin_style::uses_row_plugin public function Return TRUE if this style also uses a row plugin.
views_plugin_style::uses_tokens public function Return TRUE if this style uses tokens.
views_plugin_style::validate public function Validate that the plugin is correct and can be saved. Overrides views_plugin::validate