The PBE Base Bundle is an open source (GPL) webpage helper bundle for the eZ Publish 5 Platform.

Implemented features

  • Two level top menu generation from a folder with folders and links to be included in the pagelayout.
  • pbe_fetch_content twig function to load content in twig templates. This could, for example, be used in the pagelayout to load content from an object relation list.


January 8th 2015

Added active menu item support and support for injecting other sub-locations to directly link to.


First you'll need composer, if you don't already have it. You can execute this in your eZ Publish root directory.

curl -sS | php

then you can require the bundle:

php composer.phar require pbe/base-bundle

now you have to add the bundle to your ezpublish/EzPublishKernel.php:

use PBE\BaseBundle\PBEBaseBundle;


public function registerBundles()
    $bundles = array(
    new FrameworkBundle(),
    new PBEBaseBundle()


Finally you need to add the base.css file to your page_head_style.html.twig like this:

{% stylesheets
    <link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
{% endstylesheets %}

To override code of the PBEBaseBundle you can also make it parent of your bundle.

public function getParent()
    return 'PBEBaseBundle';

Take a look at How to Use Bundle Inheritance to Override Parts of a Bundle for more information.


top menu generator

Just include this code into your pagelayout.html.twig where you want to put your main menu. In this example 86 is the location id of the parent folder.

{{ render( controller( "PBEBaseBundle:Menu:topMenuFromFolder", { 'parentFolderLocationId': 86 } ) ) }}
This can look like this

Injecting other sub-locations to directly link to

You can also add sub-locations that are directly linked to in your menu.

For example for your menu entry with the location id 101 additionally load a maximum of 8 items of location locationId.

{{ render( controller( "PBEBaseBundle:Menu:topMenuFromFolder", {
    'parentFolderLocationId': 86,
    'directlyIncludedLocations': {
        101: {
            'locationId': 70,
            'limit': 8
} ) ) }}
This may look like this

The "Blog" menu entry has the locationId 101. The blog posts are directly loaded from the blog ('locationId': 70).


You can use this twig function in your templates to load content. In this example 57 is the content id.

{% set content = pbe_fetch_content( 57 ) %}

It will return a \eZ\Publish\Core\Repository\Values\Content\Content object.

blog comments powered by Disqus