Reputation: 75
I came to laravel and I am having trouble with blade.
So I want to have my UI components reusable, I don't want to copy and paste HTML.
@include('blocks.js.modal', array(
'title' => "{{ TextHelper::textLang('Guardar llamada','common') }}",
'close' => "{{ TextHelper::textLang('Cerrar','common') }}",
'save' => "{{ TextHelper::textLang('Guardar','common') }}"
)
)
I pass a function helper to my partial template to use this variables but I can't manage to work
There's another way to do it, I think I'm missing something.
Upvotes: 0
Views: 472
Reputation: 2269
You have to give an array and call TextHelper in your Balde template:
@include('blocks.js.modal', array(
'title' => ['Guardar llamada','common'],
'close' => ['Cerrar','common'],
'save' => ['Guardar','common']"
)
)
Then you can call in Blade like this:
"{{ TextHelper::textLang($title[0],$title[1]}}"
Hope this may help you
Upvotes: 1
Reputation: 5324
You using blade syntax in PHP style array. Change Your code like so:
@include('blocks.js.modal', [
'title' => TextHelper::textLang('Guardar llamada','common'),
'close' => TextHelper::textLang('Cerrar','common'),
'save' => TextHelper::textLang('Guardar','common')
])
Upvotes: 2