it-blaster / content-bundle
Symfony2 bundle for site content management, require Propel, Sonata and jstree
Installs: 174
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 6
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- egeloen/ckeditor-bundle: >=2.0
- it-blaster/translation-bundle: >=1.0.0
- propel/propel-bundle: >=1.0
- sonata-project/propel-admin-bundle: >=1.0
- symfony/symfony: >=2.2
This package is not auto-updated.
Last update: 2024-10-26 17:29:39 UTC
README
Installation
Add to composer.json
and install
{ "require": { "it-blaster/content-bundle": "dev-master" }, }
Add bundle to AppKernel.php
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Etfostra\ContentBundle\EtfostraContentBundle(), ); }
Add to routing.yml
EtfostraContentBundle: resource: . type: extra
Build models, run SQL and install assets
$ php app/console propel:model:build $ php app/console propel:migration:generate-diff $ php app/console propel:migration:migrate $ php app/console assets:install
To enable labels translation in SonataAdmin
framework: translator: { fallbacks: ["%locale%"] }
Cofigure
Edit your config.yml
, add etfostra_content:
etfostra_content: page_controller_name: EtfostraContentBundle:PageFront:page page_template_name: EtfostraContentBundle:Front:default.html.twig module_route_groups: # optional, modules (routes groups) - { name: News, routes: @AcmeAppBundle/Resources/config/routing_news.yml } - { name: Catalog, routes: @AcmeAppBundle/Resources/config/routing_catalog.yml }
Debug routes
$ php app/console debug:router
Twig functions
Getting link by route name:
{{ page_path('etfostra_content_56') }}
This function return link to page by "Route Name", you can copy it from Page edit form. Function prevent exception when route not found.
Getting link by slug:
{{ page_path_by_slug('any-page-slug') }}
Generates extra query! This function return link to page by Slug, you can edit and copy it on Page edit form. Function prevent exception when route not found.