You are here

function system_image_toolkit_settings in Drupal 7

Same name and namespace in other branches
  1. 5 modules/system/system.module \system_image_toolkit_settings()
  2. 6 modules/system/system.admin.inc \system_image_toolkit_settings()

Form builder; Configure site image toolkit usage.

See also

system_settings_form()

Related topics

1 string reference to 'system_image_toolkit_settings'
system_menu in modules/system/system.module
Implements hook_menu().

File

modules/system/system.admin.inc, line 1853
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) {
    variable_del('image_toolkit');
    $form['image_toolkit_help'] = array(
      '#markup' => t("No image toolkits were detected. Drupal 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 consult your system administrator to have them enabled, 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' => variable_get('image_toolkit', $current_toolkit),
      '#options' => $toolkits_available,
    );
  }
  else {
    variable_set('image_toolkit', key($toolkits_available));
  }

  // Get the toolkit's settings form.
  $function = 'image_' . $current_toolkit . '_settings';
  if (function_exists($function)) {
    $form['image_toolkit_settings'] = $function();
  }
  return system_settings_form($form);
}