Property | Type | Description | |
---|---|---|---|
$view | The view to render. Supported views are media-addon, media-callout, or media-sm. |
Method | Description | |
---|---|---|
__construct ( string $title = '', string $titleUrl = '', string $description = '', string $tag = 'div', array $attributes = [] ) | MediaItemModule constructor. | |
addButton ( string $text, string $url, $attributes ) : MediaItemModule | Adds a button to the buttons array. | |
addButtonIf ( boolean | string | array $isAllowed, string $text, string $url, $attributes ) : MediaItemModule | Adds a button to the buttons array if it satisfies the $isAllowed condition. | |
addCssClass ( $key, $class ) : MediaItemModule | Adds a css class to the cssClass array. This is useful for adding an arbitrary css class to a media item view. | |
addMeta ( string $meta ) : MediaItemModule | Adds a HTML-formatted string to the meta array. It's up to the view to concatinate this array, using something like implode(' | ', $meta) | |
addMetaIf ( boolean | string | array $isAllowed, string $meta ) : MediaItemModule | Adds a HTML-formatted string to the meta array if it satisfies the $isAllowed condition. | |
addOption ( string $key, string $value ) : MediaItemModule | Adds a HTML-formatted string to the meta array. It's up to the view to add the info in the options. | |
addOptionIf ( boolean | string | array $isAllowed, string $key, string $value ) : MediaItemModule | Adds a HTML-formatted string to the meta array if it satisfies the $isAllowed condition. | |
getAttributes ( ) : array | ||
getButtons ( ) : array | ||
getCssClasses ( ) : array | ||
getDescription ( ) : string | ||
getDropdown ( ) : DropdownModule | ||
getImageHtml ( ) : string | Renders the html for an image with the image* properties. | |
getImageSource ( ) : string | ||
getMeta ( ) : array | ||
getOptions ( ) : array | ||
getTitle ( ) : string | ||
getTitleUrl ( ) : string | ||
getToggle ( ) : array | ||
getToggleHtml ( ) : string | Rendering helper for the toggle. | |
prepare ( ) : boolean | Prepares the media item for rendering. | |
setAttributes ( array $attributes ) : MediaItemModule | ||
setDescription ( string $description ) : MediaItemModule | ||
setDropdown ( DropdownModule $dropdown ) : MediaItemModule | ||
setImage ( string $source = '', string $url = '', string $cssClass = '', string $alt = '' ) : MediaItemModule | Sets the image. The function DOES NOT handle the url()-ing. | |
setImageIf ( boolean | string | array $isAllowed, string $source = '', string $url = '', string $cssClass = '', string $alt = '' ) : MediaItemModule | Sets the image if it satisfies the $isAllowed condition. The function DOES NOT handle the url()-ing. | |
setMeta ( array $meta ) : MediaItemModule | THIS REPLACES THE META ARRAY If you want to add a meta item, use the addMeta method. | |
setTitle ( string $title ) : MediaItemModule | ||
setTitleUrl ( string $titleUrl ) : MediaItemModule | ||
setToggle ( string $key, boolean $enabled, string $url, string $label, string $cssClass = '', string $anchorCssClass = 'Hijack' ) | Sets up a anchor-style toggle. | |
setView ( string $view ) : MediaItemModule |
public __construct ( string $title = '', string $titleUrl = '', string $description = '', string $tag = 'div', array $attributes = [] ) | ||
$title | string | The media item heading. |
$titleUrl | string | If the heading is an anchor, the anchor url (the view handles url()-ing). |
$description | string | The media item description text. |
$tag | string | The root-level tag of the media item, usually a div or li. |
$attributes | array | The root-level attributes for the Media Item. |
public addButtonIf ( boolean | string | array $isAllowed, string $text, string $url, $attributes ) : MediaItemModule | ||
$isAllowed | boolean | string | array | Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check. |
$text | string | The text to display on the button. |
$url | string | The url of the button. |
$attributes | The button attributes. | |
return | MediaItemModule | $this |
public addCssClass ( $key, $class ) : MediaItemModule | ||
$key | ||
$class | ||
return | MediaItemModule | $this |
public addMetaIf ( boolean | string | array $isAllowed, string $meta ) : MediaItemModule | ||
$isAllowed | boolean | string | array | Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check. |
$meta | string | An HTML-formatted string. |
return | MediaItemModule | $this |
public addOptionIf ( boolean | string | array $isAllowed, string $key, string $value ) : MediaItemModule | ||
$isAllowed | boolean | string | array | Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check. |
$key | string | A key to access the data. |
$value | string | An HTML-formatted string. |
return | MediaItemModule | $this |
public getImageHtml ( ) : string | ||
return | string | The html for an image. |
public getToggleHtml ( ) : string | ||
return | string | An HTML-formatted string for a toggle. |
public setAttributes ( array $attributes ) : MediaItemModule | ||
$attributes | array | |
return | MediaItemModule | $this |
public setDescription ( string $description ) : MediaItemModule | ||
$description | string | |
return | MediaItemModule | $this |
public setDropdown ( DropdownModule $dropdown ) : MediaItemModule | ||
$dropdown | DropdownModule | |
return | MediaItemModule | $this |
public setImage ( string $source = '', string $url = '', string $cssClass = '', string $alt = '' ) : MediaItemModule | ||
$source | string | The image source url. The function DOES NOT handle the url()-ing. |
$url | string | The image anchor link, if the image is an anchor. The function DOES NOT handle the url()-ing. |
$cssClass | string | The CSS class for the image. |
$alt | string | The image alt. |
return | MediaItemModule | $this |
public setImageIf ( boolean | string | array $isAllowed, string $source = '', string $url = '', string $cssClass = '', string $alt = '' ) : MediaItemModule | ||
$isAllowed | boolean | string | array | Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check. |
$source | string | The image source url. The function DOES NOT handle the url()-ing. |
$url | string | The image anchor link, if the image is an anchor. The function DOES NOT handle the url()-ing. |
$cssClass | string | The CSS class for the image. |
$alt | string | The image alt. |
return | MediaItemModule | $this |
public setTitleUrl ( string $titleUrl ) : MediaItemModule | ||
$titleUrl | string | Url for title, the view handles url()-ing. |
return | MediaItemModule | $this |
public setToggle ( string $key, boolean $enabled, string $url, string $label, string $cssClass = '', string $anchorCssClass = 'Hijack' ) | ||
$key | string | The toggle key/slug |
$enabled | boolean | Whether the toggle is enabled. |
$url | string | The endpoint the toggle hits. |
$label | string | The aria-label for the toggle. |
$cssClass | string | The toggle css class. |
$anchorCssClass | string | The css class for the anchor. Should probably have 'Hijack' in there. |