Stacks - SetBlockWrapperStart and other Area functions
Permalink 2 users found helpful$a = new Area('Main'); $a->setBlockWrapperStart("<div class='cycle-image'>"); $a->setBlockWrapperEnd("</div>");
However if you want to do this to a stack, that gets a little trickier.
A stack, when used within an area appears as one block.
To grab a stack you can use,
$stack = Stack::getByName("Home Cycle Images"); $stack->display(); //Doing so, from what I can see, prevents you from accessing the area object //instead what I have done is reverted to the older method. $stack = Stack::getByName("Home Cycle Images"); $ax = Area::get($stack, STACKS_AREA_NAME); //provides the required area object $ax->setBlockWrapperStart("<div class='cycle-img'>"); $ax->setBlockWrapperEnd("</div>"); //(untested) I assume you could also then use $a->setCustomTemplate($block, $template); $ax->display($stack);
It would be nice if we could access these functions from the Stacks model.
Of course if any of this is already possible can someone point me towards the solution.
I am going to see if I can have a fiddle with the stacks model and implement it, looking through the core model it does not look too difficult to extend it to include the extra functions?
Thanks
- Sean
UCP also has a wrapper plugin model, so can wrap a pulled stack in (currently) a template from a content block or from Formigo containers. This may be more flexible than using block wrappers and can all be done without code.
If you want a minimal version of loading a stack in a block, you can use the Stack Randomizer block with just 1 stack to choose from.