Created
April 6, 2013 14:49
-
-
Save gbili/5326345 to your computer and use it in GitHub Desktop.
Error argument to getActive($active->getChildren()) is NULL whereas $active->hasChildren() is true :/
This file contains 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
<ul class="breadcrumb"> | |
<?php | |
function getActive(array $level) { | |
$activeInLevel = array_filter($level, function ($page) { | |
return $page->isActive(true); | |
}); | |
return $activeInLevel[0]; | |
}?> | |
<?php $p = $this->pages ?> | |
<?php $active = getActive($p); echo get_class($active); ?> | |
<?php while ($active->hasChildren()) : ?> | |
<li> | |
<a href="<?= $active->getHref() ?>"><?= $active->getLabel() ?></a> | |
<span class="divider">/</span> | |
<li> | |
<?php $active = getActive($active->getChildren()) ?> | |
<?php endwhile ?> | |
<li> | |
<?= $active->getLabel() ?> | |
</li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment