1 system.admin.inc | system_image_toolkit_settings() |
Form builder; Configure site image toolkit usage.
Related topics
File
- core/
modules/ system/ system.admin.inc, line 1946 - Admin page callbacks for the System module.
Code
function system_image_toolkit_settings() {
$toolkits_available = image_get_available_toolkits();
$current_toolkit = image_get_toolkit();
if (count($toolkits_available) == 0) {
config_set('system.core', 'image_toolkit', '');
$form['image_toolkit_help'] = array(
'#markup' => t("No image toolkits were detected. Backdrop includes support for <a href='!gd-link'>PHP's built-in image processing functions</a> but they were not detected on this system. You should enable them, or try using a third party toolkit.", array('gd-link' => url('http://php.net/gd'))),
);
return $form;
}
if (count($toolkits_available) > 1) {
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
'#default_value' => $current_toolkit,
'#options' => $toolkits_available
);
}
else {
$form['image_toolkit'] = array(
'#type' => 'value',
'#value' => $current_toolkit,
);
}
// Get the toolkit's settings form.
$function = 'image_' . $current_toolkit . '_settings';
if (function_exists($function)) {
$form['image_toolkit_settings'] = $function();
}
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}