TRUE, 'pie3D' => TRUE); if (!empty($data['#type'])) { if (!empty($options[$data['#type']])) { $color_palette = TRUE; } } elseif (!empty($settings['#type'])) { if (!empty($options[$settings['#type']])) { $color_palette = TRUE; } } // Merge all series option to the main data array, foreach (element_children($data) as $series) { if (!empty($settings[$series])) { $data[$series] = array_merge($settings[$series], $data[$series]); } unset($settings[$series]); // Color Palette if (empty($color_palette) and empty($data[$series]['#color'])) { $data[$series]['#color'] = trim($settings['#color_palette'][$series]); } elseif (!empty($color_palette)) { foreach (element_children($data[$series]) as $values) { if (!is_array($data[$series][$values])) { $data[$series][$values] = array( '#value' => $data[$series][$values], '#color' => trim($settings['#color_palette'][$values]) ); } elseif (empty($data[$series][$values]['#color'])) { $data[$series][$values]['#color'] = trim($settings['#color_palette'][$values]); } } } } // Now, merge all the rest of the options saved by default $data = array_merge($settings, $data); $chart_provider = $data['#plugin'] .'_chartsapi'; if (function_exists($chart_provider)) { return $chart_provider($data); } } /** * Implementation of hook_menu(). */ function charts_menu() { $items['admin/settings/charts'] = array( 'access arguments' => array('access administration pages'), 'description' => 'Set the default behaviour and look of all your charts', 'file' => 'charts.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('_charts_settings'), 'title' => 'Charts' ); // $items['admin/settings/charts/settings'] = array( // 'page arguments' => array('_charts_settings'), // 'title' => 'Settings', // 'type' => MENU_DEFAULT_LOCAL_TASK, // ); // $items['admin/settings/charts/testing'] = array( // 'file' => 'charts.inc', // 'page callback' => 'drupal_get_form', // 'page arguments' => array('_charts_testing'), // 'title' => 'Testing', // 'type' => MENU_LOCAL_TASK, // ); return $items; } /** * Implementation of hook_requirements(). */ function charts_requirements($phase) { if ($phase == 'runtime' and !$modules = module_invoke_all('chartsinfo', 'list')) { $requirements['charts']['title'] = t('Charts'); $requirements['charts']['value'] = t('No Charts provider installed'); $requirements['charts']['severity'] = REQUIREMENT_ERROR; $requirements['charts']['description'] = t('Charts core module only provides a a common set of functions. You must install a Charts provider module to create charts.'); return $requirements; } } /** * Even if the series have values with attributes, * return only the numeric values of them. * * @param * Array. A given data series with or without attributes. * @return * Array. A data series, but only with the values, without * the attributes. */ function _charts_series_values($series) { $data = array(); foreach ($series as $index => $value) { if (!is_numeric($index)) { continue; } if (is_array($value)) { $data[] = $value['#value']; } else { $data[] = $value; } } return $data; }