class SpriteTag extends BaseTag

Generates an HTML <link> tag to specify the relationship to the CSS file associated with an image sprite.

For example:

<link type="text/css" rel="stylesheet" href="https://res.cloudinary.com/demo/image/sprite/my_sprite.css">

Properties

Configuration $config from BaseTag
Image $image
ImageTransformation $additionalTransformation

Methods

videoPosterFormat(string $format)

Image format of the video poster.

useFetchFormat(bool $useFetchFormat = true)

Use fetch format transformation ("f_") instead of file extension.

__construct(string $tag, Configuration|string|array|null $configuration = null, ImageTransformation $additionalTransformation = null)

SpriteTag constructor.

configuration(Configuration|string|array|null $configuration)

Sets the configuration.

importConfiguration(Configuration|string|array|null $configuration)

Imports (merges) the configuration.

addClass(string|array $class)

Adds a tag class.

setClass(string|array $class)

Resets tag classes and sets the specified one.

setAttribute(string $key, mixed $value = null)

Sets tag attribute.

setAttributes(array $attributes)

Sets (multiple) tag attributes.

deleteAttribute(string $key)

Deletes tag attribute.

addContent(mixed $content, mixed $key = null)

Adds tag content.

setContent(mixed $content)

Sets the content of the tag to the specified one.

serialize()

Serializes the tag to string.

serializeContent(array $additionalContent = [], bool $prependAdditionalContent = false)

Serializes the tag content.

serializeAttributes(array $attributes = [])

Serializes the tag attributes.

toTag()

Serializes the tag to string.

__toString()

Serializes the tag to string.

fromParams(string $tag, array $params = [])

Creates a new sprite tag from the provided public id and array of parameters.

image(mixed $tag, Configuration $configuration = null)

Creates the sprite image.

Details

$this videoPosterFormat(string $format)

Image format of the video poster.

Parameters

Name Type Description
$format string Image format.

Return Value

$this

$this useFetchFormat(bool $useFetchFormat = true)

Use fetch format transformation ("f_") instead of file extension.

Parameters

Name Type Description
$useFetchFormat bool

Return Value

$this

__construct(string $tag, Configuration|string|array|null $configuration = null, ImageTransformation $additionalTransformation = null)

SpriteTag constructor.

Parameters

Name Type Description
$tag string
  • The sprite is created from all images with this tag.
$configuration Configuration|string|array|null The Configuration source.
$additionalTransformation ImageTransformation

Configuration configuration(Configuration|string|array|null $configuration)

Sets the configuration.

Parameters

Name Type Description
$configuration Configuration|string|array|null The Configuration source.

Return Value

Configuration

BaseTag importConfiguration(Configuration|string|array|null $configuration)

Imports (merges) the configuration.

Parameters

Name Type Description
$configuration Configuration|string|array|null The Configuration source.

Return Value

BaseTag

BaseTag addClass(string|array $class)

Adds a tag class.

Parameters

Name Type Description
$class string|array The class to add.

Return Value

BaseTag

BaseTag setClass(string|array $class)

Resets tag classes and sets the specified one.

Parameters

Name Type Description
$class string|array The class to set.

Return Value

BaseTag

BaseTag setAttribute(string $key, mixed $value = null)

Sets tag attribute.

Parameters

Name Type Description
$key string The attribute name.
$value mixed The attribute value.

Return Value

BaseTag

BaseTag setAttributes(array $attributes)

Sets (multiple) tag attributes.

Parameters

Name Type Description
$attributes array The attributes to set.

Return Value

BaseTag

BaseTag deleteAttribute(string $key)

Deletes tag attribute.

Parameters

Name Type Description
$key string The name of the attribute to delete.

Return Value

BaseTag

$this addContent(mixed $content, mixed $key = null)

Adds tag content.

Parameters

Name Type Description
$content mixed The content value.
$key mixed Optional. Used for uniqueness.

Return Value

$this

BaseTag setContent(mixed $content)

Sets the content of the tag to the specified one.

Parameters

Name Type Description
$content mixed The content of the tag.

Return Value

BaseTag

string serialize()

Serializes the tag to string.

Return Value

string

string serializeContent(array $additionalContent = [], bool $prependAdditionalContent = false)

Serializes the tag content.

Parameters

Name Type Description
$additionalContent array The additional content.
$prependAdditionalContent bool Whether to prepend additional content (instead of append).

Return Value

string

string serializeAttributes(array $attributes = [])

Serializes the tag attributes.

Parameters

Name Type Description
$attributes array Optional. Additional attributes to add without affecting the tag state.

Return Value

string

string toTag()

Serializes the tag to string.

Return Value

string

string __toString()

Serializes the tag to string.

Return Value

string

static SpriteTag fromParams(string $tag, array $params = [])

Creates a new sprite tag from the provided public id and array of parameters.

Parameters

Name Type Description
$tag string The public ID of the asset.
$params array The media asset parameters.

Return Value

SpriteTag

SpriteTag image(mixed $tag, Configuration $configuration = null)

Creates the sprite image.

Parameters

Name Type Description
$tag mixed The tag that indicates which images to use in the sprite.
$configuration Configuration The configuration instance.

Return Value

SpriteTag

Constants

SINGLE_QUOTES

DOUBLE_QUOTES

NAME

IS_VOID