You are here

function sheetnode_plugin_style::render_inject in Sheetnode 7

Same name and namespace in other branches
  1. 7.2 views/sheetnode_plugin_style.inc \sheetnode_plugin_style::render_inject()
2 calls to sheetnode_plugin_style::render_inject()
sheetnode_plugin_style::options_form in views/sheetnode_plugin_style.inc
Provide a form to edit options for this plugin.
sheetnode_plugin_style::render in views/sheetnode_plugin_style.inc
Render the display in this style.

File

views/sheetnode_plugin_style.inc, line 465

Class

sheetnode_plugin_style

Code

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);
}