function easychart_admin_options in Easychart 7.3
Returns a form with configuration options for the options.
1 string reference to 'easychart_admin_options'
File
- ./
easychart.admin.inc, line 11 - Easychart admin pages.
Code
function easychart_admin_options($form, $form_state) {
if (!isset($form_state['storage']['confirm'])) {
$form = array();
$form['easychart_options_intro'] = array(
'#markup' => t("These Highcharts options will be configurable in the Easychart interface when creating/editing a chart. See !url for all available options.", array(
'!url' => l('http://api.highcharts.com/highcharts', 'http://api.highcharts.com/highcharts', array(
'attributes' => array(
'target' => '_blank',
),
)),
)),
);
$default_options = '';
if (file_exists('public://easychart-options.json')) {
$default_options = file_get_contents('public://easychart-options.json');
}
$form['easychart_options'] = array(
'#type' => 'textarea',
'#default_value' => $default_options,
'#attributes' => array(
'class' => array(
'easychart-options',
),
),
'#rows' => 15,
);
libraries_load('highcharts');
libraries_load('easychart');
drupal_add_library('system', 'ui.sortable');
drupal_add_js(drupal_get_path('module', 'easychart') . '/js/easychart.admin.js');
drupal_add_css(drupal_get_path('module', 'easychart') . '/css/easychart.admin.css');
// Add the reset button.
$form['actions']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset to defaults'),
'#submit' => array(
'easychart_admin_options_submit',
),
'#limit_validation_errors' => array(),
'#weight' => 100,
);
// Extra validate to handle merging of options object with dump.json.
$form = system_settings_form($form);
$form['#submit'][0] = 'easychart_admin_options_merge_presave';
$form['#submit'][1] = 'system_settings_form_submit';
return $form;
}
else {
return confirm_form($form, t('Are you sure you want to reset the options to their default values?'), current_path());
}
}