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) { ...@@ -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 // If we have available toolkits allow the user to select the image toolkit to
// use and load the settings forms. // use and load the settings forms.
if (count($toolkits_available)) { $options = array();
$options = array(); foreach($toolkits_available as $id => $definition) {
foreach($toolkits_available as $id => $definition) { $options[$id] = $definition['title'];
$options[$id] = $definition['title']; }
}
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
'#default_value' => $current_toolkit,
'#options' => $options,
);
// Get the toolkit settings forms. $form['image_toolkit'] = array(
foreach ($toolkits_available as $id => $definition) { '#type' => 'radios',
$toolkit = $manager->createInstance($id); '#title' => t('Select an image processing toolkit'),
$form['image_toolkit_settings'][$id] = array( '#default_value' => $current_toolkit,
'#type' => 'fieldset', '#options' => $options,
'#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); // Get the toolkit settings forms.
} foreach ($toolkits_available as $id => $definition) {
else { $toolkit = $manager->createInstance($id);
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'))); $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; 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