Skip to content

Instantly share code, notes, and snippets.

@brianteeman
Last active April 2, 2018 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianteeman/569cb12243b9dc13706ffb8495e888e1 to your computer and use it in GitHub Desktop.
Save brianteeman/569cb12243b9dc13706ffb8495e888e1 to your computer and use it in GitHub Desktop.
When is a media manager not a media manager?

... when it's a modal

Field Types

1. media

provides modal access to the media manager for insertion of images with upload for users with appropriate permissions.

2. file

Provides an input field for files

3. filelist

provides a drop down list of files from a specified directory.

[https://docs.joomla.org/Standard_form_field_types]

##So what's the problem? There is NO way to have a field that allows you to browse ALL the media on the site.

  • 1. media is for images only
  • 2. file is for upload in a preselected folder only - no browse or select existing files (not available in com_fields)
  • 3. filelist is for selecting from a preselected folder only - no upload (not available in com_fields)

##Why does this matter? There is no field that allows you to view the entire Media Manager and all the files that it supports. This prevents you from using fields to create a field such as a file attachment (eg. pdf or zip)

##Why does this happen? The media field does not access the full media manager - the modal used is opened with the following paramater in the layout index.php?option=com_media&view=images&tmpl=component&amp It is hardcoded to only display images in the code (and also in the strings used).

This is a serious limitation of the fields api and the resulting com_fields

The media field should provide full access to com_media

##What can be done?

  • add a new fieldtype mediafiles which is a clone of the existing media field but for non-images
  • or - Completely remove the hardcoded restriction on the media field to only use images
  • or - Deprecate the media field and introduce a new field allmedia which provides full access to com_media and every filetype it supports
  • or ALL of the above

UPDATE 1

A quick look shows that we have the code to populate the list of files displayed in list.php - public function getDocuments() we just need to use it in the modal (and presumably update the js as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment