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 | |
array | $stackOptions | 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($name = null, array $stackOperations = [], array $stackOptions = [], string|null $baseUrl = null)
StackUri constructor.
null|string
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.
array
getStackOptions()
No description
AbstractStack
setStackOptions(array $options)
No description
AbstractStack
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.