You are here

class D3ViewsLibraryInfoProcessor in d3.js 7

D3 Views custom Library info processor.

Should be overridden with a hook.

Hierarchy

Expanded class hierarchy of D3ViewsLibraryInfoProcessor

2 string references to 'D3ViewsLibraryInfoProcessor'
d3_views_library_info_handlers in modules/d3_views/d3_views.module
hook_library_info_handlers in ./d3.api.php
Add custom library info handlers.

File

modules/d3_views/includes/D3ViewsLibraryInfoProcessor.inc, line 8

View source
class D3ViewsLibraryInfoProcessor extends D3LibraryInfoProcessor {
  public function process() {
    parent::process();
    $library =& $this->library
      ->value();
    if (is_array($library['views']['fields'])) {

      // Set default for the data key.
      if (!empty($library['views']['fields']['rows']) && empty($library['views']['fields']['rows']['_info']['data_key'])) {
        $library['views']['fields']['_info']['data_key'] = 'rows';
      }
    }
  }
  public function postProcessMeta(&$values) {
    if (!empty($values['form_element'])) {
      $values['form_element'] = $this
        ->hash($values['form_element']);
    }

    // TODO: Add functionality for the rows data type.
    if (!isset($values['cardinality'])) {
      $values['cardinality'] = 1;
    }
  }

  /**
   * Ensure there are hashes in form_element arrays.
   *
   * Could potentially go in parent class.
   */
  protected function hash($element) {
    foreach ($element as $key => $value) {
      if (strpos($key, '#') === FALSE) {
        $element['#' . $key] = $value;
        unset($element[$key]);
      }
    }
    return $element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
D3LibraryInfoProcessor::$key private property Current key being processed.
D3LibraryInfoProcessor::$keys private property Specific keys to parse in the info file.
D3LibraryInfoProcessor::$library protected property Current library to process.
D3LibraryInfoProcessor::getKey public function Get the current key being processed.
D3LibraryInfoProcessor::parseSpecialString protected function Parse special strings into arrays.
D3LibraryInfoProcessor::processFile protected function Load a file specified in an info file.
D3LibraryInfoProcessor::processMeta protected function Parse through magic meta keys.
D3LibraryInfoProcessor::processValues protected function Sub function to start a recursive process.
D3LibraryInfoProcessor::setKey public function Set the current key being processed.
D3LibraryInfoProcessor::setKeys public function Set the info file keys to be processed.
D3LibraryInfoProcessor::trim protected function Helper function to process info line with [] or {}.
D3LibraryInfoProcessor::__construct public function
D3ViewsLibraryInfoProcessor::hash protected function Ensure there are hashes in form_element arrays.
D3ViewsLibraryInfoProcessor::postProcessMeta public function
D3ViewsLibraryInfoProcessor::process public function Main function to process the info file for the current keys. Overrides D3LibraryInfoProcessor::process