You are here

function _print_main_settings_validate in Printer, email and PDF versions 6

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. 7.2 print.admin.inc \_print_main_settings_validate()
  4. 7 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_url;

  // Check for a new uploaded logo, and use that instead.
  if ($file = file_save_upload('print_logo_upload', array(
    'file_validate_is_image' => array(),
  ))) {
    $parts = pathinfo($file->filename);
    $filename = 'print_logo.' . drupal_strtolower($parts['extension']);

    // 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 (file_copy($file, $filename, FILE_EXISTS_REPLACE)) {
      $form_state['values']['print_logo_options'] = 2;
      $form_state['values']['print_logo_url'] = base_path() . $file->filepath;
    }
  }
}