Actions

Difference between revisions of "Media form field type"

From Joomla! Documentation

(Summarize the main XML attributes of the JFORM field type "media")
 
(Add preview parameter preview (added in 2.5.5))
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
Attributes: name, type[=media], label, description, directory
+
The '''media''' form field type provides modal access to the media manager for the choice of an image. Users with appropriate permissions will be able to upload files.
  
The directory attribute should be relative to the top level /images/ folder, so to have the media selector opened with the directory /images/stories/ already selected:
+
* '''type''' (mandatory) must be ''media''.
 +
* '''name''' (mandatory) is the unique name of the field.
 +
* '''label''' (mandatory) (translatable) is the descriptive title of the field.
 +
* '''description''' (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
 +
* '''directory''' (mandatory) is the directory from which the user will be able to choose a file. This attribute should be relative to the top level <code>/images/</code> folder.
 +
* '''preview''' (optional) shows or hides the preview of the currently chosen image. ("true": Show always, "tooltip": Show as tooltip, "false": Show never) (since Joomla! 2.5.5)
  
<field name="image0" type="media" directory="stories" />
+
Example XML field definition:
 +
<source lang="xml">
 +
<field name="myimage" type="media" directory="stories" />
 +
</source>
 +
 
 +
This will open the media manager with the directory <code>/images/stories/</code> already selected.
 +
<noinclude>
 +
=== See also ===
 +
* [[File form field type]]
 +
* [[Imagelist form field type]]
 +
* [[Standard form field types|List of standard form field types]]
 +
[[Category:Standard form field types]]</noinclude>

Latest revision as of 01:51, 19 June 2012

The media form field type provides modal access to the media manager for the choice of an image. Users with appropriate permissions will be able to upload files.

  • type (mandatory) must be media.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • directory (mandatory) is the directory from which the user will be able to choose a file. This attribute should be relative to the top level /images/ folder.
  • preview (optional) shows or hides the preview of the currently chosen image. ("true": Show always, "tooltip": Show as tooltip, "false": Show never) (since Joomla! 2.5.5)

Example XML field definition:

<field name="myimage" type="media" directory="stories" />

This will open the media manager with the directory /images/stories/ already selected.

See also