Problem/Motivation

The scheme step (file_entity_add_upload_step_scheme) is not skipped on the multi step file upload form when there is a single scheme available.

Proposed resolution

The fix is the same as #2411391: File destination not showing. The array_intersect_key() fails, returning nothing in file_entity_add_upload_submit().

Remaining tasks

Fix

User interface changes

Skipped step for a single scheme functionality will return.

API changes

N/A

Data model changes

N/A

CommentFileSizeAuthor
#1 2532104.patch567 bytesdamiankloip
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

Status: Active » Needs review
FileSize
567 bytes
Dave Reid’s picture

What version of the media module were you using? It might be possible this was resolved with #2363897: Unable to select required field destination on media upload?

Dave Reid’s picture

Status: Needs review » Postponed (maintainer needs more info)
damiankloip’s picture

Status: Postponed (maintainer needs more info) » Needs review

Looks like the same problem exists in the 7.x-2.x branch. file_entity_add_upload_step_scheme() uses array_flip:

  // Remove any schemes not found in the instance settings.
  if (!empty($options['schemes'])) {
    $schemes = array_intersect_key($schemes, array_flip($options['schemes']));
  }

Where as file_entity_add_upload_submit doesn't:

  // Remove any schemes not found in the instance settings.
  if (!empty($options['schemes'])) {
    $schemes = array_intersect_key($schemes, $options['schemes']);
  }

The code paths are the same, using the same options from $form['#options']. This always leads to empty schemes, so it will never == 1. When the actual scheme step is displayed it is fine, as that is fixed per the first code snippet above.

Dave Reid’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'm unable to replicate any bugs with just having one scheme available (public only). I will need some better steps to reproduce the issue.

damiankloip’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Oh, I think I see what was happening. file_entity alone was fine as file_entity_add_upload() has no options on the file upload page. With media module, however, file_entity_add_upload() is used on the media browser. I think that is where the wrong options were passed. With the latest media module this work fine though.