dev-master
9999999-devWebpage helper bundle for eZ Publish Platform (dropdown menu from folders and links, twig content fetcher function)
GPL-2.0
The Requires
- ezsystems/ezpublish-kernel *
- php >=5.3.0
menu ezpublish
Webpage helper bundle for eZ Publish Platform (dropdown menu from folders and links, twig content fetcher function)
The PBE Base Bundle is a webpage helper bundle for the eZ Publish 5 Platform., (*1)
You may also want to visit the PBEBaseBundle Project Webpage for more informations., (*2)
Two level top menu generation from a folder with folders and links to be included in the pagelayout., (*3)
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., (*4)
First you'll need composer, if you don't already have it. You can execute this in your eZ Publish root directory., (*5)
curl -sS https://getcomposer.org/installer | php
Then you can require the bundle:, (*6)
php composer.phar "pbe/base-bundle":"dev-master"
Now you have to add the bundle to your ezpublish/EzPublishKernel.php
:, (*7)
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:, (*8)
{% stylesheets '@eZDemoBundle/Resources/public/css/bootstrap.css' ... '@PBEBaseBundle/Resources/public/css/base.css' %} <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., (*9)
public function getParent() { return 'PBEBaseBundle'; }
Take a look at How to Use Bundle Inheritance to Override Parts of a Bundle for more information., (*10)
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., (*11)
{{ render( controller( "PBEBaseBundle:Menu:topMenuFromFolder", { 'parentFolderLocationId': 86 } ) ) }}
, (*12)
You can also add sub-locations that are directly linked to in your menu., (*13)
For example for your menu entry with the location id 101
additionally load a maximum of 8
items of location locationId
., (*14)
{{ render( controller( "PBEBaseBundle:Menu:topMenuFromFolder", { 'parentFolderLocationId': 86, 'directlyIncludedLocations': { 101: { 'locationId': 70, 'limit': 8 } } } ) ) }}
The "Blog" menu entry has the locationId
101
.
The blog posts are directly loaded from the blog ('locationId': 70
)., (*15)
, (*16)
You can use this twig function in your templates to load content. In this example 57
is the content id., (*17)
{% set content = pbe_fetch_content( 57 ) %}
It will return a \eZ\Publish\Core\Repository\Values\Content\Content
object., (*18)
Webpage helper bundle for eZ Publish Platform (dropdown menu from folders and links, twig content fetcher function)
GPL-2.0
menu ezpublish