You are here

public function D3ViewsDataMapping::getMapping in d3.js 7

Get the current mapping configuration.

1 call to D3ViewsDataMapping::getMapping()
D3ViewsDataMapping::map in modules/d3_views/includes/D3ViewsDataMapping.inc
Map views fields to library info specified field names.

File

modules/d3_views/includes/D3ViewsDataMapping.inc, line 313

Class

D3ViewsDataMapping

Code

public function getMapping() {
  if (empty($this->plugin->options['fields'])) {
    return array();
  }
  $map = array();
  foreach ($this->plugin->options['fields'] as $key => $values) {

    // If it's a single field.
    if (!empty($values['field'])) {
      $map[$key] = $values['field'];
    }
    else {

      // If it has multiple subfields.
      foreach ($values as $k => $v) {
        if (!empty($v['field'])) {
          $map[$key][$k] = $v['field'];
        }
      }
    }
  }
  return $map;
}