Skip to content

Instantly share code, notes, and snippets.

View janit's full-sized avatar

Jani Tarvainen janit

View GitHub Profile
Verifying that +janitarvainen is my blockchain ID. https://onename.com/janitarvainen
@janit
janit / knpmenu.php
Last active January 27, 2016 06:15
<?php
use Knp\Menu\MenuFactory;
use Knp\Menu\Renderer\ListRenderer;
$factory = new MenuFactory();
$menu = $factory->createItem('My menu');
$menu->addChild('Home', array('uri' => '/'));
$menu->addChild('Comments', array('uri' => '#comments'));
$menu->addChild('Symfony2', array('uri' => 'http://symfony-reloaded.org/'));
rollerworks_navigation:
menus:
menu-name:
template: ~ # optional template, used by the Menu builder
items:
item-name: # name of the item, eg. home, products, and such.
label: ~ # Label of the menu-item, this will be translated with the translator_domain
translator_domain: Menus # translator domain for the label
route: { name: ~, parameters: { } } # The route.name can not be empty, parameters is optional
uri: ~ # Alternatively you can use a URI instead of a route
<?php
$factory = $this->container->get('ktw_database_menu.factory');
$menu = $factory->createItem('root');
$menu->addChild('Home', array('route' => 'homepage'));
$menu->addChild('About Me', array(
'route' => 'page_show',
'routeParameters' => array('id' => 42)));
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Icicle\Coroutine\Coroutine;
use Icicle\Loop;
use Icicle\Awaitable;
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Icicle\Coroutine\Coroutine;
use Icicle\Loop;
use Icicle\Awaitable;
<?php
/**
* Displays the list of blog_post.
*
* @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return \Symfony\Component\HttpFoundation\Response
*/
parameters:
app.controller.blog.class: AppBundle\Controller\BlogController
services:
app.controller.blog:
class: %app.controller.blog.class%
arguments:
- @ezpublish.api.service.content
- @ezpublish.api.service.search
- @ezpublish.api.service.location
<?php
/**
* @param \eZ\Publish\API\Repository\ContentService $contentService
* @param \eZ\Publish\API\Repository\SearchService $searchService
* @param \eZ\Publish\API\Repository\LocationService $locationService
* @param \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver
* @param \AppBundle\Criteria\Children $childrenCriteria
* @param int $randomPostsLimit
* @param int $blogPostLimit
ezpublish:
system:
default:
location_view:
full:
blog:
controller: app.controller.blog:listBlogPostsAction
template: full\blog.html.twig
match:
Identifier\ContentType: [blog]