Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow HTML in field labels #97

Closed
se1exin opened this issue Sep 5, 2016 · 6 comments
Closed

Allow HTML in field labels #97

se1exin opened this issue Sep 5, 2016 · 6 comments

Comments

@se1exin
Copy link
Contributor

se1exin commented Sep 5, 2016

During development of a project today I noticed that some fields allow HTML in field labels (e.g. text.blade.php) whilst others do not (e.g. textarea.blade.php).

I find the ability to use HTML in the label very useful for adding custom 'required' statements to the label. For example:

$this->crud->addField([
            'name' => 'overlay_title',
            'label' => 'Overlay Title <em><small>required</small></em>',
            'type' => 'text'
            ]);

The only thing that needs to change is the <label> line in each template to change from:
<label>{{ $field['label'] }}</label>
to:
<label>{!! $field['label'] !!}</label>

I'm putting a PR together for this right now, but any other feedback on the pros/cons of implementing this are welcomed.

@tabacitu
Copy link
Member

tabacitu commented Sep 5, 2016

You're totally right, that SHOULD be available for all field types. Thanks for the PR!
Cheers!

@wtime
Copy link

wtime commented Sep 26, 2016

For escape the label of the checklist you need to do this:

CRUD/src/resources/views/fields/checklist.blade.php

Line 17 @endif > {!! $connected_entity_entry->{$field['attribute']} !!}

@tabacitu
Copy link
Member

Sorry @wtime , I didn't get that. Could you please rephrase it? Cheers!

@wtime
Copy link

wtime commented Sep 26, 2016

change
{{ $connected_entity_entry->{$field['attribute']} }}

to

{!! $connected_entity_entry->{$field['attribute']} !!}

for correct HTML unescaping of the label of the checklist field.

PATH: CRUD/src/resources/views/fields/checklist.blade.php

@tabacitu
Copy link
Member

Thank you @wtime . It's now fixed!
Cheers!

@wtime
Copy link

wtime commented Sep 27, 2016

Thank you for your great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants