You are here

protected function D3LibraryInfoProcessor::processMeta in d3.js 7

Parse through magic meta keys.

2 calls to D3LibraryInfoProcessor::processMeta()
D3LibraryInfoProcessor::processFile in includes/D3LibraryInfoProcessor.inc
Load a file specified in an info file.
D3LibraryInfoProcessor::processValues in includes/D3LibraryInfoProcessor.inc
Sub function to start a recursive process.

File

includes/D3LibraryInfoProcessor.inc, line 158
D3 .info file processor class.

Class

D3LibraryInfoProcessor
Parse additional information from library .info files.

Code

protected function processMeta(&$values) {
  $info = array();
  foreach ($values as $key => $row) {
    if (is_array($row)) {

      // Recursive in case this is a file.
      $this
        ->processMeta($values[$key]);
    }

    // Ensure the underscores are at the beginning.
    if (strpos($key, '__') === 0) {

      // Remove meta information.
      unset($values[$key]);
      $count = 1;
      $key = str_replace('__', '', $key, $count);
      $info[$key] = is_string($row) ? trim($row) : $row;
    }
  }

  // Check to see if there were hidden values, otherwise this _info key
  // would show up everywhere blank.
  if (!empty($info)) {
    if (method_exists($this, 'postProcessMeta')) {
      $this
        ->postProcessMeta($info);
    }
    $values['_info'] = $info;
  }
}