nymo / silex-twig-breadcrumb-extension Goto Github PK
View Code? Open in Web Editor NEWTwig breadcrumb extension with service provider for Silex
License: MIT License
Twig breadcrumb extension with service provider for Silex
License: MIT License
And do not use a Singleton anymore...
Usage is wrong, should be:
$app['breadcrumbs']->addItem()
Make second parameter of addItem optional
Update Template to translate
{{ breadcrumb.linkName|trans }}
Hey,
I get the error:
FatalErrorException in BreadCrumbCollection.php line 71:
Error: Call to a member function generate() on null
My app.php looks like
<?php
use Silex\Application;
use Silex\Provider;
//
// Application setup
//
$app = new Application();
$app->register(new Provider\DoctrineServiceProvider());
$app->register(new Provider\SecurityServiceProvider());
$app->register(new Provider\RememberMeServiceProvider());
$app->register(new Provider\SessionServiceProvider());
$app->register(new Provider\ServiceControllerServiceProvider());
$app->register(new Provider\UrlGeneratorServiceProvider());
$app->register(new Provider\TwigServiceProvider());
$app->register(new \nymo\Silex\Provider\BreadCrumbServiceProvider());
$app['twig.path'] = array(__DIR__ . '/../templates');
//$app['twig.options'] = array('cache' => __DIR__ . '/../var/cache/twig');
$app['twig'] = $app->share(
$app->extend(
'twig',
function ($twig, $app) {
$twig->addExtension(new \nymo\Twig\Extension\BreadCrumbExtension($app));
return $twig;
}
)
);
$app->register(new Provider\SwiftmailerServiceProvider());
// Register the SimpleUser service provider.
$simpleUserProvider = new SimpleUser\UserServiceProvider();
$app->register($simpleUserProvider);
//
// Controllers
//
$app->mount('/user', $simpleUserProvider);
$app->get('/', 'Piano\Controller\PagesController::indexAction')->bind('homepage');
$app->get('/ueber-uns', 'Piano\Controller\PagesController::aboutAction')->bind('about');
require __DIR__ . '/../config/local.php';
return $app;
When I change a Template and reload it the first time, I get this:
Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Unable to register extension "renderBreadCrumbs" as extensions have already been initialized.") in "layout.html" at line 225.
After a reload it's okay and works. Sometimes this happens randomly
Allow additional usage of named routes for links in a form like
$app['breadcrumbs']->addItem('named_route');
We should also support PHP 7 as Silex supports it, too.
Currently you have add the TranslationServiceProvider in order to use the current extension or override the template and remove the trans filter.
We should make the trans filter optional again and remove the dependency to the TranslationServiceProvider.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.