Skip to content

Instantly share code, notes, and snippets.

@schmunk42
Last active Dec 16, 2015
Embed
What would you like to do?
Example how to customize Phundament Bootstrap Menu with P3Pages and custom database items.
<?php
class Helper
{
static public function getMenuItems($rootNode = null)
{
if ($rootNode === null) {
$rootNode = P3Page::model()->findByAttributes(array('layout' => '_BootMenu'));
}
$items = P3Page::getMenuItems($rootNode);
$items[0]['items'] = array();
$subjects = Subject::model()->findAll();
foreach ($subjects AS $subject) {
$items[0]['items'][] = array('label' => $subject->name,
'url' => Yii::app()->controller->createUrl('/site/archive', array('id' => $subject->id)));
}
return $items;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment