function imageapi_optimize_internal_binary_settings in Image Optimize (or ImageAPI Optimize) 7
Form callback for Internal binary settings.
1 string reference to 'imageapi_optimize_internal_binary_settings'
- imageapi_optimize_menu in ./
imageapi_optimize.module - Implements hook_menu().
File
- services/
internal.inc, line 99 - Internal ImageAPI Optimize service.
Code
function imageapi_optimize_internal_binary_settings($form, $form_state, $name) {
$info = imageapi_optimize_info();
if (isset($info['binaries'][$name])) {
$binary = $info['binaries'][$name];
$settings = variable_get('imageapi_optimize_' . $name, array());
// Include binary file if defined and available.
if (isset($binary['file'])) {
include_once $binary['file'];
}
$form['imageapi_optimize_' . $name] = array(
'#type' => 'container',
'#tree' => TRUE,
);
$form['imageapi_optimize_' . $name]['status'] = array(
'#title' => t('Enabled'),
'#type' => 'checkbox',
'#default_value' => isset($settings['status']) ? $settings['status'] : FALSE,
);
$form['imageapi_optimize_' . $name]['path'] = array(
'#type' => 'textfield',
'#title' => t('Path to @name', array(
'@name' => $name,
)),
'#default_value' => isset($settings['path']) ? $settings['path'] : '',
'#element_validate' => array(
'imageapi_optimize_validate_path',
),
);
if (isset($binary['description'])) {
$form['imageapi_optimize_' . $name]['path']['#description'] = $binary['description'];
}
$form['imageapi_optimize_' . $name]['weight'] = array(
'#type' => 'value',
'#value' => $binary['weight'],
);
// Binary specific settings form.
$advanced_settings = isset($settings['settings']) ? $settings['settings'] : $binary['settings'];
$form['imageapi_optimize_' . $name]['settings'] = array(
'#title' => t('Advanced settings'),
'#type' => 'fieldset',
) + $binary['callbacks']['form']($advanced_settings);
return system_settings_form($form);
}
// Binary doesn't exist.
drupal_not_found();
drupal_exit();
}