StackUri
class StackUri extends AbstractStack (View source)
This class is useful for working on stack URIs (dynamic or defined ones).
You can use almost all the operations you can use on a common stack object here as well, but also retrieve such a stack as rokka render URL for later usage in templates or similar.
Examples:
$stackUri = new StackUri('someStackName');
$stackUri->addOverridingOptions('options-dpr-2');
echo $stackUri->getStackUriString();
Properties
string|null | $name | from AbstractStack | |
StackOperation[] | $stackOperations | from AbstractStack | |
(bool|float|int|string)[] | $stackOptions | from AbstractStack | |
(bool|float|int|string)[] | $stackVariables | from AbstractStack |
Methods
StackUri constructor.
Returns all operations matching name.
Adds a StackOperation to the list of existing Stack Operations.
Sets a single Stack option to the list of existing Stack options.
No description
Returns the stack uri in 'dynamic' notation.
Returns the stack url part as it should be with "addOptionsToUrl" calls in 'dynamic' notation.
Gets stack operations / options as "flat" array.
For overwriting stack operation options or adding stack options.
Details
__construct(string|null $name = null, array $stackOperations = [], array $stackOptions = [], array $stackVariables = [])
StackUri constructor.
string|null
getName()
Get name of stack for url.
AbstractStack
setName(string $name)
No description
StackOperation[]
getStackOperations()
No description
StackOperation[]
getStackOperationsByName(string $name)
Returns all operations matching name.
AbstractStack
setStackOperations(array $operations)
No description
AbstractStack
addStackOperation(StackOperation $stackOperation)
Adds a StackOperation to the list of existing Stack Operations.
(bool|float|int|string)[]
getStackOptions()
No description
AbstractStack
setStackOptions(array $options)
No description
(bool|float|int|string)[]
getStackVariables()
No description
AbstractStack
setStackVariables(array $variables)
No description
AbstractStack
addStackOption(string $key, bool|float|int|string $value)
Sets a single Stack option to the list of existing Stack options.
__toString()
No description
UriInterface
getStackUri()
Returns the stack uri in 'dynamic' notation.
string
getStackUriString()
Returns the stack url part as it should be with "addOptionsToUrl" calls in 'dynamic' notation.
array
getConfigAsArray()
Gets stack operations / options as "flat" array.
Useful for generating dynamic stacks for example
StackUri
addOverridingOptions(string $options)
For overwriting stack operation options or adding stack options.
The format of the $options parameter is the same as you would use for overwriting ooptions via a render URL.
Example: 'resize-width-200--options-dpr-2-autoformat-true'
Using '/' instead of '--' is also valid, but if the object doesn't have operations defined already, the behaviour is different Examples:
'resize-width-200--crop-width-200-height-200' <- resizes and crops and image 'resize-width-200/crop-width-200-height-200' <- only resized the image, since the crop is an overwrite and the operation doesnt exist
But if there's already stack operations for resize and crop defined in the object, both above examples do the same.