Commit 8b8b8b34 authored by catch's avatar catch

Issue #1712258 by alexpott, dagmar, Shuairan, disasm, slv_: Simplify image...

Issue #1712258 by alexpott, dagmar, Shuairan, disasm, slv_: Simplify image toolkit form logic, removing unneeded checks.
parent 87462db6
......@@ -1841,38 +1841,33 @@ function system_image_toolkit_settings($form, &$form_state) {
// If we have available toolkits allow the user to select the image toolkit to
// use and load the settings forms.
if (count($toolkits_available)) {
$options = array();
foreach($toolkits_available as $id => $definition) {
$options[$id] = $definition['title'];
}
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
'#default_value' => $current_toolkit,
'#options' => $options,
);
$options = array();
foreach($toolkits_available as $id => $definition) {
$options[$id] = $definition['title'];
}
// Get the toolkit settings forms.
foreach ($toolkits_available as $id => $definition) {
$toolkit = $manager->createInstance($id);
$form['image_toolkit_settings'][$id] = array(
'#type' => 'fieldset',
'#title' => t('@toolkit settings', array('@toolkit' => $definition['title'])),
'#collapsible' => TRUE,
'#collapsed' => ($id == $current_toolkit) ? FALSE : TRUE,
'#tree' => TRUE,
);
$form['image_toolkit_settings'][$id] += $toolkit->settingsForm();
}
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
'#default_value' => $current_toolkit,
'#options' => $options,
);
$form = system_config_form($form, $form_state);
}
else {
form_set_error('image_toolkit', t('There are no image toolkits available. Drupal comes with support for PHP\'s GD image toolkit. This requires that the GD module for PHP be installed and configured properly. For more information see <a href="@url">PHP\'s image documentation</a>.', array('@url' => 'http://php.net/image')));
// Get the toolkit settings forms.
foreach ($toolkits_available as $id => $definition) {
$toolkit = $manager->createInstance($id);
$form['image_toolkit_settings'][$id] = array(
'#type' => 'fieldset',
'#title' => t('@toolkit settings', array('@toolkit' => $definition['title'])),
'#collapsible' => TRUE,
'#collapsed' => ($id == $current_toolkit) ? FALSE : TRUE,
'#tree' => TRUE,
);
$form['image_toolkit_settings'][$id] += $toolkit->settingsForm();
}
$form = system_config_form($form, $form_state);
return $form;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment