Documentation

PackStylesFunction extends BaseFunction
in package

Pack a hash of CSS styles into a single attribute.

Use with unpackStyles to manipulate CSS styles.

{% set myStyles = unpackStyles(styleString) %}
{% set myStyles = myStyles|merge({
 'width': '100%',
 'margin': 'auto'
}) %}

<div style="{{ packStyles(myStyles) }}"></div>
Tags
see
UnpackStylesFunction

Table of Contents

__construct()  : mixed
getDI()  : mixed
getFunctionName()  : string
Return function name
getFunctionOptions()  : mixed
handle()  : string
Accepts a hash from TWIG and returns a style attribute string

Methods

__construct()

public __construct() : mixed
Return values
mixed

getFunctionName()

Return function name

public getFunctionName() : string
Return values
string

getFunctionOptions()

public getFunctionOptions() : mixed
Return values
mixed

handle()

Accepts a hash from TWIG and returns a style attribute string

public handle(array<string|int, mixed> $styles) : string
Parameters
$styles : array<string|int, mixed>
Return values
string

Search results