When our users upload local images to the site using the Media Browser widget and the Upload tab, the filetype selection step is skipped. I recently received a request to allow users to add external resources to their pages. As I test this, I see that step 2 is not skipped, but the users only have one option.

skip filetype selection - external video

skip filetype selection - external image

Is it possible to skip this step also? Thank you.

*

Media Module: 7.x-2.0-rc5

File Entity Module: 7.x-2.0-beta3

Media oEmbed Module: 7.x-2.7

CommentFileSizeAuthor
#5 fix-for-skip-step-2903665-5.patch837 bytesann b
image.png6.99 KBann b
video.png7.46 KBann b

Comments

ann b created an issue. See original summary.

joseph.olstad’s picture

Status: Active » Fixed

yes it is possible:
/admin/config/media/file-settings

click a checkbox on the option "Skip filetype selection."
then press save

ann b’s picture

Status: Fixed » Active

I think there is a small bug in the code. Let's give the module maintainers a chance to weigh in. Apologies if I turn out to be wrong.

In the following submit handler, the condition on the last line below is not met when adding an external file:

function file_entity_add_upload_submit($form, &$form_state) {
  $form_state['storage'] = isset($form_state['storage']) ? $form_state['storage'] : array();
  $form_state['storage'] = array_merge($form_state['storage'], $form_state['values']);

  // This var is set to TRUE when we are ready to save the file.
  $save = FALSE;
  $trigger = $form_state['triggering_element']['#id'];

  $steps_to_check = array(2, 3);
  if ($trigger == 'edit-previous') {
    // If the previous button was hit,
    // the step checking order should be reversed 3, 2.
    $steps_to_check = array_reverse($steps_to_check);
  }

  foreach ($steps_to_check as $step) {
    // Check if we can skip step 2 and 3.
    if (($form['#step'] == $step - 1 && $trigger == 'edit-next') || ($form['#step'] == $step + 1 && $trigger == 'edit-previous')) {
      ... // code to skip steps
   }

In the first condition, this is because $trigger is set to edit-next--2, not edit-next. So the code block does not get executed. This may have been intentional, or as I said a small bug.

joseph.olstad’s picture

Status: Active » Postponed (maintainer needs more info)

What version of file_entity are you using? The issue was openned with 7.x-2.0-beta3, this is not a current version.

ann b’s picture

Version: 7.x-2.0-beta3 » 7.x-2.x-dev
Component: Documentation » Code
Category: Support request » Bug report
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new837 bytes