Media Content Type
- Last Modified:
- 08 May 2019
- User Level:
The Media Content Type is a System Content Type. Since System Content Types are used by the TERMINALFOUR system, they are pre-configured on install. The Media Library uses this Content Type when an item is added or edited.
Since the Media Content Type is used by the system to add and edit Media Library items, edits should not be made to the Content Elements.
Editing this Content Type may impact Media Library functionality.
When you are configuring a Media Type, one or more Media Content Layouts can be associated with it. To add an existing Media Content Layout, select Add row and choose it from the Media Content Layout dropdown list. When more than Media Content Layout is associated with a Media Type, a default can be selected:
The Default is the Media Content Layout that is used when a Media Item is selected from the HTML Editor.
Media Content Layouts
A Media Content Layout is a Content Layout associated with the Media Content Type. You can view all Media Content Layouts by going to Assets > Content Types and filtering for the Media Content Type (this is a System Content Type) It can be edited in the same way as any other Content Layout:
There are some Media Content Layouts that are pre-configured with a fresh install of TERMINALFOUR. These include:
|Name||Description||Content Layout Code|
Add a Media Item to an HTML page as a link.
This would typically be used for Media Items like MS Office documents, PDFs and other files that you intend a user to download.
|css/*||Add a CSS Media Item to an HTML page with the link element||
|image/*||Add an image Media Item to an HTML page in an
If you have added custom Media Types, you may also have additional Content Layouts. To edit a Content Layout, select Edit on the Actions menu for the Content Layout.
Modifying a Media Content Layout will update the published versions of all Media Items using that Media Content Layout.
A Media Type can use one or more Media Content Layouts. If more than one is available, a default can be defined. Where a default is defined there is no need to add a formatter attribute to the T4 Tag. Alternatively, a Media T4 Tag can specify which Media Content Layout is used.
A Media Content Layout must include a T4 Tag to output the Media Item (highlighted below). In this example, the Media is an image and the Description element is used to populate the alt text of the image.
<img src="<t4 type="content" name="Media" output="file" modifiers="" />" alt="<t4 type="content" name="Description" output="normal" modifiers="striptags,htmlentities" />" />
HTML attributes can be added to the Media Content Layout markup to provide more control over how a Media Item is published on a page. In the example above, the default alt text is populated by the Description element from the Media Library.
You could also specify a width and/or height to resize an image. Media Attributes are T4 Tags within the Media Content Layout.
Setting up Media Types and Media Content Layouts