Your cart is empty!
Render
apply_filters( 'vikappointments_render_media', string $html, array $file, JModel $model )
Fires while rendering an unknown media type.
Description
Trigger hook to allow external plugins to implement a layout for their own media types. The media types are always rendered within the media manager.
The HTML supports 2 different blocks: one for the thumbnail and the other one for the preview, which must provide the inspector-only
class.
Parameters
- $html
-
(string) The HTML to display.
- $file
-
(array) An associative array holding some details of the file.
file
- the full path of the file;path
- the directory in which the file is stored;name
- the file name (inclusive of extension);file_ext
- the file extension (dot included);size
- a readable file size, adjusted to the closest unit;timestamp
- the UNIX timestamp of the creation date;creation
- a readable creation date;name_no_ext
- the file name without the file extension;uri
- the full URI of the file;width
- the width (in pixel) of the file (for images only);height
- the height (in pixel) of the file (for images only).
- $model
-
(JModel) The model instance that handles the saving process.
Example
/**
* Trigger hook to allow external plugins to implement a layout for
* their own media types.
*
* @param string $html The resulting HTML.
* @param array $file An array of file properties.
* @param JModel $model The model instance.
*/
add_filter('vikappointments_render_media', function($html, $file, $model)
{
if (preg_match("/\.(xml)$/", $file['name']))
{
// display a new icon for XML files
return '<i class="fas fa-file-code" data-src="' . $file['uri'] .'"></i>';
}
return $html;
}, 10, 3);
Changelog
Version | Description |
---|---|
1.2 | Introduced. |
Last Update: 2021-10-08
Helpful?