file_markup — Get HTML for a set of files.
Summary
- file_markup($files, array $options = array(), $wrapperAttributes = array('class' => 'item-file'))
Get HTML for a set of files.
- Parameters:
$files (
File) – A file record or an array of File records to display.$options (
array) – Options to customize display for different file types.$wrapperAttributes (
array) – Attributes HTML attributes for the div that wraps each displayed file. If empty or null, this will not wrap the displayed file in a div.
- Returns:
string HTML
Usage
The second argument, $props, is an array of options to customize the display of files. Which options are valid depend on the particular file type and on whether a plugin has added a new method for displaying that file, but
there are some fairly standard available options.
Options for many possible file types can be specified all together. Each file will only use the options that are valid for its type, and ignore the others.
imageSizeAvailable for images. Default:
square_thumbnailA string naming the size of image to use. The possible sizes are
thumbnail,square_thumbnail, andfullsize.linkToFileAvailable for images and unknown-type files. Default:
trueWhether the display should be wrapped in a direct link directly the file.
truemakes a link to the original file,falsemakes no link, and a string links to the specified image size (thumbnail, square_thumbnail, or fullsize).linkToMetadataAvailable for images and unknown-type files. Default:
falseIf
true, wrap the file in a link to the file’s “show” metadata page. This option overrideslinkToFilewhentrue.imgAttributesAvailable for images. Default: none
An array of attributes to set on the HTML
<img>tag. Keys of the array are attribute names, and values of the array are attribute values.linkTextAvailable for unknown-type files. Default:
nullThe text to display for the file (inside the link if one of the linking options is enabled). If null or omitted, the file’s Dublin Core Title (if available) or original filename are used as the text.
width,heightAvailable for most audio and video types. Defaults vary.
The pixel height and width of the audio or video player.
Examples
file_markup can be passed just a file or array of files alone to
produce the default display:
// Display one specific File
echo file_markup($file);
// Display all the given Files (here, the files for an Item)
echo file_markup($item->Files);
One of the simplest uses of file_markup’s display options is to display
a fullsize image instead of a small square thumbnail:
echo file_markup($file, array('imageSize' => 'fullsize'));