Check if block is in a stack
Permalink
I'd like to check, from the view, if the current block is in a stack without relying upon the "Main" area handle used by the core_stack_display. Is this possible?
I think the problem with the above is that while a block may or may not be in a stack, a stack is often on a page. (EDIT). Also, its probably creating a new instance rather than retrieving an existing parent instance.
The Quick Stack View block I currently have in the PRB may help illustrate.
The Quick Stack View block I currently have in the PRB may help illustrate.
Just found in some old code (written before stacks and global areas existed), from a block view you can do:
Then check that directly against the areas table of the database to see if the area is global.
Beware that simply instantiating the area and then enquiring on the area object can create phantom areas that clog up the database and lead to spurious results.
$this->block->getAreaHandle()
Then check that directly against the areas table of the database to see if the area is global.
Beware that simply instantiating the area and then enquiring on the area object can create phantom areas that clog up the database and lead to spurious results.
Thanks John, I've already used the following in the view to decipher if the block is in a global area and kill display outside edit mode:
My issue is now finding if the block (from within view.php) is in a regular stack or not. I've dug through the API to find the "BlockCoreStackDisplayController" but that doesn't seem to work like the similar code I found (link above), as though it is not seeing an instance of the "core_stack_display controller?!
Any suggestions as to how to stop banging my head on my keyboard, other than seeing a psychiatrist, would be great. :D
$egareahandle = $this->area->getAreaHandle(); $egblockhandle = $this->block->getAreaHandle(); if ($egareahandle == $egblockhandle)....
My issue is now finding if the block (from within view.php) is in a regular stack or not. I've dug through the API to find the "BlockCoreStackDisplayController" but that doesn't seem to work like the similar code I found (link above), as though it is not seeing an instance of the "core_stack_display controller?!
Any suggestions as to how to stop banging my head on my keyboard, other than seeing a psychiatrist, would be great. :D
http://www.concrete5.org/community/forums/customizing_c5/custom-blo...
I've tried this (and many other approaches with no results):
Any ideas?