AudioMedium
extends Medium
in package
implements
AudioMediaInterface
uses
AudioMediaTrait
Class AudioMedium
Table of Contents
Interfaces
- AudioMediaInterface
- Class implements audio media interface.
Properties
- $basename : string
- $filename : string
- $filepath : string
- $metadata : array<string|int, mixed>
- $mime : string
- $modified : int
- $size : int
- $timestamp : int|string
- $_thumbnail : MediaObjectInterface|null
- $alternatives : array<string|int, MediaObjectInterface>
- $attributes : array<string|int, mixed>
- $blueprints : Blueprint|callable|null
- $gettersVariable : string
- $items : array<string|int, mixed>
- $medium_querystring : array<string|int, mixed>
- $mode : string
- $parsedown : Parsedown|null
- $storage : FileInterface|null
- $styleAttributes : array<string|int, mixed>
- $thumbnailType : string|null
- $thumbnailTypes : array<string|int, mixed>
Methods
- __call() : $this
- Allow any action to be called on this medium from twig or markdown
- __clone() : mixed
- Clone medium.
- __construct() : mixed
- Construct.
- __toString() : string
- Return string representation of the object (html).
- addAlternative() : mixed
- Add alternative Medium to this Medium.
- addMetaFile() : mixed
- Add meta file for the medium.
- attribute() : $this
- Add custom attribute to medium.
- blueprints() : Blueprint
- Return blueprints.
- classes() : $this
- Add a class to the element from Markdown or Twig Example:  or 
- controlsList() : $this
- Allows to set the controlsList behaviour Separate multiple values with a hyphen
- copy() : static
- Create a copy of this media object
- display() : MediaObjectInterface|null
- Switch display mode.
- exists() : bool
- Check if this medium exists or not
- extra() : array<string|int, mixed>
- Get extra items which haven't been defined in blueprints.
- file() : FileInterface|null
- Set or get the data storage.
- filter() : $this
- Filter all items by using blueprints.
- get() : mixed
- Get value by using dot notation for nested arrays/objects.
- getAlternatives() : array<string|int, mixed>
- getDefaults() : array<string|int, mixed>
- Get nested structure containing default values defined in the blueprints.
- getJoined() : array<string|int, mixed>
- Get value from the configuration and join it with given data.
- getMeta() : array<string|int, mixed>
- Returns an array containing the file metadata
- html() : string
- Return HTML markup from the medium.
- id() : $this
- Add an id to the element from Markdown or Twig Example: 
- join() : $this
- Join nested values together by using blueprints.
- joinDefaults() : $this
- Set default values by using blueprints.
- jsonSerialize() : array<string|int, mixed>
- lightbox() : MediaLinkInterface
- Turn the current Medium into a Link with lightbox enabled
- link() : MediaLinkInterface
- Turn the current Medium into a Link
- merge() : $this
- Merge two configurations together.
- meta() : Data
- Return just metadata from the Medium object
- metadata() : array<string|int, mixed>
- Returns an array containing just the metadata
- modified() : int|null
- Get file modification time for the medium.
- parsedownElement() : array<string|int, mixed>
- Get an element (is array) that can be rendered by the Parsedown engine
- path() : string
- Return PATH to file.
- querystring() : string
- Get/set querystring for the file's url
- raw() : string
- Return unmodified data as raw string.
- relativePath() : string
- Return the relative path to file
- reset() : $this
- Reset medium.
- save() : void
- Save data if storage has been defined.
- set() : $this
- Set value by using dot notation for nested arrays/objects.
- setDefaults() : $this
- Set default values to the configuration if variables were not set.
- setKeepEmptyValues() : $this
- setMissingValuesAsNull() : $this
- setTimestamp() : $this
- Set querystring to file modification timestamp (or value provided as a parameter).
- size() : int
- Get size of the medium.
- style() : $this
- Allows to add an inline style attribute from Markdown or Twig Example: 
- thumbnail() : $this
- Switch thumbnail.
- thumbnailExists() : bool
- Helper method to determine if this media item has a thumbnail or not
- url() : string
- Return URL to file.
- urlHash() : string
- Get/set hash for the file's url
- urlQuerystring() : string
- Get the URL with full querystring
- validate() : $this
- Validate by blueprints.
- value() : mixed
- Get value by using dot notation for nested arrays/objects.
- createLink() : MediaLinkInterface
- createThumbnail() : Medium|null
- getGrav() : Grav
- getItems() : array<string|int, mixed>
- getThumbnail() : ThumbnailImageMedium|null
- Get the thumbnail Medium object
- sourceParsedownElement() : array<string|int, mixed>
- Parsedown element for source display mode
- textParsedownElement() : array<string|int, mixed>
- Parsedown element for text display mode
Properties
$basename
public
string
$basename
$filename
public
string
$filename
$filepath
public
string
$filepath
$metadata
public
array<string|int, mixed>
$metadata
$mime
public
string
$mime
$modified
public
int
$modified
$size
public
int
$size
$timestamp
public
int|string
$timestamp
$_thumbnail
protected
MediaObjectInterface|null
$_thumbnail
$alternatives
protected
array<string|int, MediaObjectInterface>
$alternatives
= []
$attributes
protected
array<string|int, mixed>
$attributes
= []
$blueprints
protected
Blueprint|callable|null
$blueprints
$gettersVariable
protected
string
$gettersVariable
= 'items'
$items
protected
array<string|int, mixed>
$items
$medium_querystring
protected
array<string|int, mixed>
$medium_querystring
= []
$mode
protected
string
$mode
= 'source'
$parsedown
protected
Parsedown|null
$parsedown
$storage
protected
FileInterface|null
$storage
$styleAttributes
protected
array<string|int, mixed>
$styleAttributes
= []
$thumbnailType
protected
string|null
$thumbnailType
$thumbnailTypes
protected
array<string|int, mixed>
$thumbnailTypes
= ['page', 'default']
Methods
__call()
Allow any action to be called on this medium from twig or markdown
public
__call(string $method, array<string|int, mixed> $args) : $this
Parameters
- $method : string
- $args : array<string|int, mixed>
Attributes
- #[ReturnTypeWillChange]
Return values
$this__clone()
Clone medium.
public
__clone() : mixed
Attributes
- #[ReturnTypeWillChange]
__construct()
Construct.
public
__construct([array<string|int, mixed> $items = [] ][, Blueprint|null $blueprint = null ]) : mixed
Parameters
- $items : array<string|int, mixed> = []
- $blueprint : Blueprint|null = null
__toString()
Return string representation of the object (html).
public
__toString() : string
Attributes
- #[ReturnTypeWillChange]
Return values
stringaddAlternative()
Add alternative Medium to this Medium.
public
addAlternative(int|float $ratio, MediaObjectInterface $alternative) : mixed
Parameters
- $ratio : int|float
- $alternative : MediaObjectInterface
addMetaFile()
Add meta file for the medium.
public
addMetaFile(string $filepath) : mixed
Parameters
- $filepath : string
attribute()
Add custom attribute to medium.
public
attribute([string $attribute = null ][, string $value = '' ]) : $this
Parameters
- $attribute : string = null
- $value : string = ''
Return values
$thisblueprints()
Return blueprints.
public
blueprints() : Blueprint
Return values
Blueprintclasses()
Add a class to the element from Markdown or Twig Example:  or 
public
classes() : $this
Return values
$thiscontrolsList()
Allows to set the controlsList behaviour Separate multiple values with a hyphen
public
controlsList(string $controlsList) : $this
Parameters
- $controlsList : string
Return values
$thiscopy()
Create a copy of this media object
public
copy() : static
Return values
staticdisplay()
Switch display mode.
public
display([string $mode = 'source' ]) : MediaObjectInterface|null
Parameters
- $mode : string = 'source'
Return values
MediaObjectInterface|nullexists()
Check if this medium exists or not
public
exists() : bool
Return values
boolextra()
Get extra items which haven't been defined in blueprints.
public
extra() : array<string|int, mixed>
Return values
array<string|int, mixed>file()
Set or get the data storage.
public
file([FileInterface|null $storage = null ]) : FileInterface|null
Parameters
- $storage : FileInterface|null = null
-
Optionally enter a new storage.
Return values
FileInterface|nullfilter()
Filter all items by using blueprints.
public
filter() : $this
Return values
$thisget()
Get value by using dot notation for nested arrays/objects.
public
abstract get(string $name[, mixed $default = null ][, string|null $separator = null ]) : mixed
Parameters
- $name : string
-
Dot separated path to the requested value.
- $default : mixed = null
-
Default value (or null).
- $separator : string|null = null
-
Separator, defaults to '.'
Tags
Return values
mixed —Value.
getAlternatives()
public
getAlternatives([bool $withDerived = true ]) : array<string|int, mixed>
Parameters
- $withDerived : bool = true
Return values
array<string|int, mixed>getDefaults()
Get nested structure containing default values defined in the blueprints.
public
getDefaults() : array<string|int, mixed>
Fields without default value are ignored in the list.
Return values
array<string|int, mixed>getJoined()
Get value from the configuration and join it with given data.
public
getJoined(string $name, array<string|int, mixed>|object $value[, string $separator = '.' ]) : array<string|int, mixed>
Parameters
- $name : string
-
Dot separated path to the requested value.
- $value : array<string|int, mixed>|object
-
Value to be joined.
- $separator : string = '.'
-
Separator, defaults to '.'
Tags
Return values
array<string|int, mixed>getMeta()
Returns an array containing the file metadata
public
getMeta() : array<string|int, mixed>
Return values
array<string|int, mixed>html()
Return HTML markup from the medium.
public
html([string|null $title = null ][, string|null $alt = null ][, string|null $class = null ][, string|null $id = null ][, bool $reset = true ]) : string
Parameters
- $title : string|null = null
- $alt : string|null = null
- $class : string|null = null
- $id : string|null = null
- $reset : bool = true
Return values
stringid()
Add an id to the element from Markdown or Twig Example: 
public
id(string $id) : $this
Parameters
- $id : string
Return values
$thisjoin()
Join nested values together by using blueprints.
public
join(string $name, mixed $value[, string $separator = '.' ]) : $this
Parameters
- $name : string
-
Dot separated path to the requested value.
- $value : mixed
-
Value to be joined.
- $separator : string = '.'
-
Separator, defaults to '.'
Tags
Return values
$thisjoinDefaults()
Set default values by using blueprints.
public
joinDefaults(string $name, mixed $value[, string $separator = '.' ]) : $this
Parameters
- $name : string
-
Dot separated path to the requested value.
- $value : mixed
-
Value to be joined.
- $separator : string = '.'
-
Separator, defaults to '.'
Return values
$thisjsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Attributes
- #[ReturnTypeWillChange]
Return values
array<string|int, mixed>lightbox()
Turn the current Medium into a Link with lightbox enabled
public
lightbox([int|null $width = null ][, int|null $height = null ][, bool $reset = true ]) : MediaLinkInterface
Parameters
- $width : int|null = null
- $height : int|null = null
- $reset : bool = true
Return values
MediaLinkInterfacelink()
Turn the current Medium into a Link
public
link([bool $reset = true ][, array<string|int, mixed> $attributes = [] ]) : MediaLinkInterface
Parameters
- $reset : bool = true
- $attributes : array<string|int, mixed> = []
Return values
MediaLinkInterfacemerge()
Merge two configurations together.
public
merge(array<string|int, mixed> $data) : $this
Parameters
- $data : array<string|int, mixed>
Return values
$thismeta()
Return just metadata from the Medium object
public
meta() : Data
Return values
Datametadata()
Returns an array containing just the metadata
public
metadata() : array<string|int, mixed>
Return values
array<string|int, mixed>modified()
Get file modification time for the medium.
public
modified() : int|null
Return values
int|nullparsedownElement()
Get an element (is array) that can be rendered by the Parsedown engine
public
parsedownElement([string|null $title = null ][, string|null $alt = null ][, string|null $class = null ][, string|null $id = null ][, bool $reset = true ]) : array<string|int, mixed>
Parameters
- $title : string|null = null
- $alt : string|null = null
- $class : string|null = null
- $id : string|null = null
- $reset : bool = true
Return values
array<string|int, mixed>path()
Return PATH to file.
public
path([bool $reset = true ]) : string
Parameters
- $reset : bool = true
Return values
string —path to file
querystring()
Get/set querystring for the file's url
public
querystring([string|null $querystring = null ][, bool $withQuestionmark = true ]) : string
Parameters
- $querystring : string|null = null
- $withQuestionmark : bool = true
Return values
stringraw()
Return unmodified data as raw string.
public
raw() : string
NOTE: This function only returns data which has been saved to the storage.
Return values
stringrelativePath()
Return the relative path to file
public
relativePath([bool $reset = true ]) : string
Parameters
- $reset : bool = true
Return values
stringreset()
Reset medium.
public
reset() : $this
Return values
$thissave()
Save data if storage has been defined.
public
save() : void
Tags
set()
Set value by using dot notation for nested arrays/objects.
public
abstract set(string $name, mixed $value[, string|null $separator = null ]) : $this
Parameters
- $name : string
-
Dot separated path to the requested value.
- $value : mixed
-
New value.
- $separator : string|null = null
-
Separator, defaults to '.'
Tags
Return values
$thissetDefaults()
Set default values to the configuration if variables were not set.
public
setDefaults(array<string|int, mixed> $data) : $this
Parameters
- $data : array<string|int, mixed>
Return values
$thissetKeepEmptyValues()
public
setKeepEmptyValues(bool $value) : $this
Parameters
- $value : bool
Return values
$thissetMissingValuesAsNull()
public
setMissingValuesAsNull(bool $value) : $this
Parameters
- $value : bool
Return values
$thissetTimestamp()
Set querystring to file modification timestamp (or value provided as a parameter).
public
setTimestamp([string|int|null $timestamp = null ]) : $this
Parameters
- $timestamp : string|int|null = null
Return values
$thissize()
Get size of the medium.
public
size() : int
Return values
intstyle()
Allows to add an inline style attribute from Markdown or Twig Example: 
public
style(string $style) : $this
Parameters
- $style : string
Return values
$thisthumbnail()
Switch thumbnail.
public
thumbnail([string $type = 'auto' ]) : $this
Parameters
- $type : string = 'auto'
Return values
$thisthumbnailExists()
Helper method to determine if this media item has a thumbnail or not
public
thumbnailExists([string $type = 'page' ]) : bool
Parameters
- $type : string = 'page'
-
;
Return values
boolurl()
Return URL to file.
public
abstract url([bool $reset = true ]) : string
Parameters
- $reset : bool = true
Return values
stringurlHash()
Get/set hash for the file's url
public
urlHash([string|null $hash = null ][, bool $withHash = true ]) : string
Parameters
- $hash : string|null = null
- $withHash : bool = true
Return values
stringurlQuerystring()
Get the URL with full querystring
public
urlQuerystring(string $url) : string
Parameters
- $url : string
Return values
stringvalidate()
Validate by blueprints.
public
validate() : $this
Tags
Return values
$thisvalue()
Get value by using dot notation for nested arrays/objects.
public
value(string $name[, mixed $default = null ][, string $separator = '.' ]) : mixed
Parameters
- $name : string
-
Dot separated path to the requested value.
- $default : mixed = null
-
Default value (or null).
- $separator : string = '.'
-
Separator, defaults to '.'
Tags
Return values
mixed —Value.
createLink()
protected
createLink(array<string|int, mixed> $attributes) : MediaLinkInterface
Parameters
- $attributes : array<string|int, mixed>
Return values
MediaLinkInterfacecreateThumbnail()
protected
createThumbnail(string $thumb) : Medium|null
Parameters
- $thumb : string
Return values
Medium|nullgetGrav()
protected
getGrav() : Grav
Return values
GravgetItems()
protected
getItems() : array<string|int, mixed>
Return values
array<string|int, mixed>getThumbnail()
Get the thumbnail Medium object
protected
getThumbnail() : ThumbnailImageMedium|null
Return values
ThumbnailImageMedium|nullsourceParsedownElement()
Parsedown element for source display mode
protected
sourceParsedownElement(array<string|int, mixed> $attributes[, bool $reset = true ]) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
- $reset : bool = true
Return values
array<string|int, mixed>textParsedownElement()
Parsedown element for text display mode
protected
textParsedownElement(array<string|int, mixed> $attributes[, bool $reset = true ]) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
- $reset : bool = true