public function canBuild(array $menus, sfActionStackEntry $action_entry) { if ($action_entry->getModuleName() == 'swBlogTagsAdmin') { return true; } return false; }
public function buildMenu(array $menus, sfActionStackEntry $action_entry) { $menus['main']->addChild(new swMenuElement(array('route' => 'swBlogPostsAdmin/index', 'name' => 'blog'))); if (preg_match('/swBlog*/', $action_entry->getModuleName())) { $menus['sidebar']->addChild(new swMenuElement(array('route' => 'swBlogPostsAdmin/index', 'name' => 'post', 'id' => 'swBlogPostsAdmin.index'))); $menus['sidebar']->addChild(new swMenuElement(array('route' => 'swBlogCommentsAdmin/index', 'name' => 'comments', 'id' => 'swBlogCommentsAdmin.index'))); $menus['sidebar']->addChild(new swMenuElement(array('route' => 'swBlogTagsAdmin/index', 'name' => 'tags', 'id' => 'swBlogTagsAdmin.index'))); } }
public function buildMenu(array $menus, sfActionStackEntry $action_entry) { $main_element = new swMenuElement(array('name' => __('index', null, 'swBlogPostsAdmin'), 'route' => 'swBlogPostsAdmin/index', 'id' => 'swBlogPostsAdmin.index')); $main_element->addChild(new swMenuElement(array('name' => __('link_create', null, 'swBlogPostAdmin'), 'route' => 'swBlogPostsAdmin/create'))); if (isset($action_entry->getActionInstance()->form) && !$action_entry->getActionInstance()->form->isNew()) { $sw_blog_comment = $action_entry->getActionInstance()->form->getObject(); $element = new swMenuElement(array('name' => __('show_post', null, 'swBlogCommentsAdmin'), 'route' => 'swBlogPostsAdmin/edit?id=' . $sw_blog_comment->getPostId())); $main_element->addChild($element); } $menus['sidebar']->addChild($element); }
public function buildMenu(array $menus, sfActionStackEntry $action_entry) { $main_element = new swMenuElement(array('name' => __('index', null, 'swBlogPostsAdmin'), 'route' => 'swBlogPostsAdmin/index', 'id' => 'swBlogPostsAdmin.index')); $main_element->addChild(new swMenuElement(array('name' => __('link_create', null, 'swBlogPostAdmin'), 'route' => 'swBlogPostsAdmin/create'))); if (isset($action_entry->getActionInstance()->form) && !$action_entry->getActionInstance()->form->isNew()) { $sw_blog_post = $action_entry->getActionInstance()->form->getObject(); $element = new swMenuElement(); $element->setName(__('show_comments', null, 'swBlogCommentsAdmin')); $element->setRoute('swBlogCommentsAdmin/index', array('query_string' => http_build_query(array('filters' => array('post_id' => $sw_blog_post->getId(), 'moderated' => ''))))); $main_element->addChild($element); $element = new swMenuElement(); $element->setName(__('show', null, 'swBlogPostsAdmin')); $element->setRoute('swBlogPostsAdmin/edit?id=' . $sw_blog_post->getId()); $main_element->addChild($element); } $menus['sidebar']->addChild($main_element); }