Skip to content

Instantly share code, notes, and snippets.

@schmunk42
Last active December 16, 2015 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmunk42/5506650 to your computer and use it in GitHub Desktop.
Save schmunk42/5506650 to your computer and use it in GitHub Desktop.
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