StackUri
class StackUri extends StackAbstract (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 StackAbstract | |
StackOperation[] | $stackOperations | from StackAbstract | |
array | $stackOptions | from StackAbstract |
Methods
No description
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($name = null, array $stackOperations = [], array $stackOptions = [], $baseUrl = null)
No description
null|string
getName()
Get name of stack for url.
StackAbstract
setName(string $name)
No description
StackOperation[]
getStackOperations()
No description
StackOperation[]
getStackOperationsByName(string $name)
Returns all operations matching name.
StackAbstract
setStackOperations(array $operations)
No description
StackAbstract
addStackOperation(StackOperation $stackOperation)
Adds a StackOperation to the list of existing Stack Operations.
array
getStackOptions()
No description
StackAbstract
setStackOptions(array $options)
No description
StackAbstract
addStackOption(string $key, mixed $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.