Created
October 11, 2017 11:30
-
-
Save katzueno/e5cdc11e833c4df0af2ccd133cb84fae to your computer and use it in GitHub Desktop.
Stack display tips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Concrete\Core\Block\View\BlockView; | |
defined('C5_EXECUTE') or die('Access Denied.'); | |
$c = Page::getCurrentPage(); | |
$cp = new Permissions($c); | |
if ($cp->canViewPageVersions()) { | |
$stack = Stack::getByID($stID); | |
} else { | |
$stack = Stack::getByID($stID, 'ACTIVE'); | |
} | |
if ($stack) { | |
$ax = Area::get($stack, STACKS_AREA_NAME); | |
$axp = new Permissions($ax); | |
if ($axp->canRead()) { | |
$blocks = $ax->getAreaBlocksArray(); | |
$v = \View::getRequestInstance(); | |
shuffle($blocks); | |
foreach ($blocks as $block) { | |
$blockview = new BlockView($block); | |
$blockview->setAreaObject($ax); | |
$p = new Permissions($block); | |
if ($p->canViewBlock()) { | |
if (!$c->isEditMode()) { | |
echo $stack->enclosingStart; | |
} | |
$blockview->render('view'); | |
if (!$c->isEditMode()) { | |
echo $stack->enclosingEnd; | |
} | |
} | |
break; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$stack = \Stack::getByName($sidebarPopularAreaName, 'ACTIVE'); | |
$ax = Area::get($stack, STACKS_AREA_NAME); | |
$axp = new Permissions($ax); | |
if ($axp->canRead()) { | |
$ax->disableControls(); | |
$ax->setCustomTemplate('block_handle+1', 'template_name.php'); | |
$ax->setCustomTemplate('block_handle_2', 'template_name.php'); | |
$ax->display($stack); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment