Open TheFox opened 9 years ago
Perhaps better to remove the extensions and just let people add the function names.
But link_to()
is provided by TwigBridge\Extension\Laravel\Html
. How can I use link_to()
?
Oh eh, I'll need to take a look. Don't use the html/form stuff.
But why are the HTML functions listed in the README while it's not available in the code? The README says I can use it.
Well it was there by default in L4, but removed from L5. It did work but they probably changed the signature sometime.
You can also use the HTML
and Form
facades directly, if you add them to the facades list in the config.
Submitted a fix to LaravelCollective: https://github.com/LaravelCollective/html/pull/30
Merged and tagged. Does updating laravelcollective/html now work for you?
No.
Still the same error:
Cannot instantiate Twig extension 'TwigBridge\Extension\Laravel\Form': Unresolvable dependency resolving [Parameter #2 [
$csrfToken ]] in class Collective\Html\FormBuilder
I'm using
I put the config into ConfigServiceProvider
.
This is what it looks like:
public function register(){
config(array(
'twigbridge' => array(
'extensions' => array(
'enabled' => array(
'TwigBridge\Extension\Loader\Facades',
'TwigBridge\Extension\Loader\Filters',
'TwigBridge\Extension\Loader\Functions',
'TwigBridge\Extension\Laravel\Auth',
'TwigBridge\Extension\Laravel\Config',
'TwigBridge\Extension\Laravel\Input',
'TwigBridge\Extension\Laravel\Session',
'TwigBridge\Extension\Laravel\String',
'TwigBridge\Extension\Laravel\Translator',
'TwigBridge\Extension\Laravel\Url',
'TwigBridge\Extension\Laravel\Form',
'TwigBridge\Extension\Laravel\Html',
),
'facades' => array(
),
'functions' => array(
'dd',
),
),
),
));
}
I'm getting the same error for Form & HTML
Has anyone found a solution how to use Form?
Do you use v0.8? I used v0.7. Maybe the newest version is now working. I don't know, I didn't tried it with v0.8.
Not sure if this is the same problem I was having, but I have a pull request which clarifies the README on how to get the Form and Html helpers working for Laravel 5.1
@jordanlev I've getting an error with Lumen. Installed laravelcollective/html, enabled service provider and extensions and now I'm getting this error:
InvalidArgumentException in ServiceProvider.php line 236:
Cannot instantiate Twig extension 'TwigBridge\Extension\Laravel\Form':
Argument 1 passed to Collective\Html\HtmlBuilder::__construct()
must be an instance of Illuminate\Routing\UrlGenerator,
instance of Laravel\Lumen\Routing\UrlGenerator given,
called in \vendor\laravelcollective\html\src\HtmlServiceProvider.php on line 39
laravel/lumen-framework v5.1.6 laravelcollective/html v5.1.7 rcrowe/twigbridge v0.8.2 twig/extensions v1.3.0
UPD: got it, laravelcollective/html incompatible with Lumen ATM :( https://github.com/LaravelCollective/html/issues/41
Hi,
how can enable
TwigBridge\Extension\Laravel\Html
in Laravel 5, TwigBridge 0.7?In
rcrowe/twigbridge/config/twigbridge.php
it is disabled by default. As described in 0.7/README.md:But there is no
myapp/config/extensions.php
. How must this file look like?I also put the config into my
myapp/app/Providers/ConfigServiceProvider.php
but it also doesn't work.For example when I want to use
link_to()
in my Twig template.The only way it works is when enabling the extension in
rcrowe/twigbridge/config/twigbridge.php
.The README.md says that the
link_to()
function isadded by the default Extensions
.When enabling
TwigBridge\Extension\Laravel\Form
:I installed
laravelcollective/html
as TwigBridgesuggest
incomposer.json
. But I would rather putlaravelcollective/html
intorequire
notsuggest
. However, this solves not the problem.