You are here

function _print_main_settings_validate in Printer, email and PDF versions 7

Same name and namespace in other branches
  1. 5.4 print.admin.inc \_print_main_settings_validate()
  2. 5.3 print.admin.inc \_print_main_settings_validate()
  3. 6 print.admin.inc \_print_main_settings_validate()
  4. 7.2 print.admin.inc \_print_main_settings_validate()
  5. 5.x print.admin.inc \_print_main_settings_validate()

Validate print_main_settings form.

1 string reference to '_print_main_settings_validate'
print_main_settings in ./print.admin.inc
Menu callback for the Printer-friendly pages module settings form.

File

./print.admin.inc, line 173
Contains the administrative functions of the PF module.

Code

function _print_main_settings_validate($form, &$form_state) {
  global $base_root;

  // Check for a new uploaded logo, and use that instead.
  if ($file = file_save_upload('print_logo_upload', array(
    'file_validate_is_image' => array(),
  ))) {

    // The image was saved using file_save_upload() and was added to the
    // files table as a temporary file. We'll make a copy and let the garbage
    // collector delete the original upload.
    if ($filename = file_unmanaged_copy($file->uri)) {
      $wrapper = file_stream_wrapper_get_instance_by_uri($filename);
      $form_state['values']['print_logo_options'] = 2;
      $form_state['values']['print_logo_url'] = str_replace($base_root, '', $wrapper
        ->getExternalUrl());
    }
  }
}