You are here

function file_admin_file_entity_edit_validate in File admin 7

Validate handler for file_entity_edit form.

Prepare additional fields' data for saving to the file entity. Actual saving is handled by file_entity_edit_submit().

1 string reference to 'file_admin_file_entity_edit_validate'
_file_admin_add_file_admin_fieldset in ./file_admin.module
Helper to build the Workflow fieldset.

File

./file_admin.module, line 340
Enhances file administration by adding published, promote, and sticky fields.

Code

function file_admin_file_entity_edit_validate($form, &$form_state) {

  // Validate the "posted on" field.
  if (!empty($form_state['values']['date']) && strtotime($form_state['values']['date']) === FALSE) {
    form_set_error('date', t('You have to specify a valid date.'));
  }
  $created = !empty($form_state['values']['date']) ? strtotime($form_state['values']['date']) : time();
  form_set_value($form['created'], $created, $form_state);
}