function easychart_admin_options_merge_presave in Easychart 7.3
Form submit handler
1 string reference to 'easychart_admin_options_merge_presave'
- easychart_admin_options in ./
easychart.admin.inc - Returns a form with configuration options for the options.
File
- ./
easychart.admin.inc, line 62 - Easychart admin pages.
Code
function easychart_admin_options_merge_presave($form, &$form_state) {
// Merge options with dump.xml
$current_options = json_decode($form_state['values']['easychart_options']);
// Get all options.
$full_options = drupal_json_decode(file_get_contents(libraries_get_path('easychart') . '/src/js/config/dump.json'));
$all_options = array();
foreach ($full_options as $key => $value) {
$all_options[$value['fullname']] = $value;
}
// Start iterating and find the panes.
foreach ($current_options as $key => $info) {
if (isset($info->panes)) {
foreach ($info->panes as $s_key => $s_value) {
if (isset($s_value->options)) {
foreach ($s_value->options as $ss_key => $ss_value) {
if ($ss_value->fullname) {
$current_options[$key]->panes[$s_key]->options[$ss_key] = (object) array_merge((array) $ss_value, $all_options[$ss_value->fullname]);
}
}
}
}
}
}
// Write to file.
file_unmanaged_save_data(json_encode($current_options), 'public://easychart-options.json', FILE_EXISTS_REPLACE);
}