When setting up a file field to use ONLY remote youtube links, you can't leave the "Allowed file extensions for uploaded files" field blank (it's required).
If I don't want to allow local files, this is not possible.

Also, when creating a node that includes the filefield, there is always still the option to upload a file (which is not desirable).

Files: 
CommentFileSizeAuthor
#8 Selection_012.jpg150.84 KBjhedstrom

Comments

Title:Can't ONLY allow remote youtube files for fieldRestrict field to only web videos; remove/hide file upload sections

Agreed, this is confusing. It seems like the current functionality is keyed off of a file upload (although the field type, while categorized under file, is helpfully described as a "media file selector" rather than a "media file upload," which I appreciate!).

The current setup means:

  • Adding the field is confusing, because you have to first pick an "upload destination," even if you only want to allow access to videos already on YouTube.
  • You see a "file (field) path settings" section, even if you don't ever want any videos uploaded.
  • You have to provide at least one type of allowable upload file type (defaults to .txt).
  • As noted by the OP, when clicking on the button for that field in a node form, you get "upload," "web," and "library" tabs, defaulting to "upload," even though all you want is "web."

I guess the field was built to allow people to upload videos and choose videos from the web, which is great flexibility! But it would also be nice to have the flexibility of restricting the field to web videos alone.

Project:Media: YouTube» Media
Component:User interface» Media Internet

Sorry, I realized this is really a core Media module issue. I'm moving it over to that queue.

Anyone know of a quick work around to this issue?

NVM. with media-2.x you can select what plugins you want to allow.

I want same functionality but I want to hide web tab if I don't select youtube option. Any progress????

Friends, some solution for this?

thanks,

Issue summary:View changes

I'm not sure how this is handled in Media 2 (per this issue) but there is a solution to hide the Upload tab that is working in my Media 1 implementation. It may be adaptable to the other tabs. You can see it here: https://drupal.org/node/1281486

StatusFileSize
new150.84 KB

I have a use case that cannot be resolved by hiding the upload tab: we need the WYSIWYG media browser to allow *image* and *document* uploads, but only allow videos from the *web* tab (disallowing direct video upload, but allowing youtube/vimeo). With the latest media 2, there doesn't appear to be any way to configure allowed extensions independent of allowed types

I was able to hack around the issue using a form alter to remove video types from the upload tab, yet still allow web uploads:

<?php
/**
* Implements hook_form_FORM_ID_alter().
*/
function MYMODULE_form_file_entity_add_upload_alter(&$form, $form_state) {
 
// Strip out any video types from allowed extensions. We cannot use normal
  // configuration for this since that would also disallow video in the 'Web'
  // tab. See https://drupal.org/comment/8584897#comment-8584897.
 
$video_types = explode(' ', 'mp3 mov mp4 m4a m4v mpeg avi ogg oga ogv weba webp webm');
 
$allowed_extensions = $form['upload']['#upload_validators']['file_validate_extensions'][0];
  foreach (
$video_types as $extension) {
   
$allowed_extensions = str_replace($extension, '', $allowed_extensions);
   
$allowed_extensions = str_replace('  ', ' ', $allowed_extensions);
  }
 
$form['upload']['#upload_validators']['file_validate_extensions'][0] = $allowed_extensions;
}
?>