You are here

function imagemagick_element_validate_path in ImageMagick 7

Form element validation handler for convert executable path setting.

1 string reference to 'imagemagick_element_validate_path'
image_imagemagick_settings in ./imagemagick.module
Retrieve settings for the ImageMagick toolkit.

File

./imagemagick.module, line 91
Provides ImageMagick integration.

Code

function imagemagick_element_validate_path($element, &$form_state) {
  if ($form_state['values']['image_toolkit'] == 'imagemagick') {

    // During form validation, we want to prevent form submission, so regardless
    // of whether _imagemagick_convert_exec() will trigger a user error (which
    // may not be visible due to the global error_level setting), we also need
    // to trigger a form validation error.
    $status = _imagemagick_check_path($element['#value']);
    if ($status['errors']) {

      // Form API allows only one error per element, so we concatenate possibly
      // multiple errors.
      form_error($element, implode('<br />', $status['errors']));
    }
  }
}