class JsConfigTag extends BaseTag

Generates an HTML <script/> tag for JavaScript:

<script type="text/javascript">
$.cloudinary.config({"api_key":"key","cloud_name":"name"});
</script>

Properties

Configuration $config from BaseTag

Methods

videoPosterFormat(string $format)

Image format of the video poster.

useFetchFormat(bool $useFetchFormat = true)

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

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

JsConfigTag 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.

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(Configuration|string|array|null $configuration = null)

JsConfigTag constructor.

Parameters

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

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

Constants

SINGLE_QUOTES

DOUBLE_QUOTES

NAME

IS_VOID