caffeinated / menus

:pushpin: Menu generator package for the Laravel framework
https://caffeinatedpackages.com
132 stars 59 forks source link

Menu items with icons are auto-escaped #9

Closed ikhrome closed 9 years ago

ikhrome commented 9 years ago

Thank you very much, you made a great job and saved a lot of my time!

Just little correction for wiki in bootstrap template: we need to use {!! $item->title !!} to disable auto-escaping and now we can use icons.

So, the new template is:

@foreach($items as $item)
    <li @if($item->hasChildren())class ="dropdown"@endif>
        @if($item->link) <a @if($item->hasChildren()) class="dropdown-toggle" data-toggle="dropdown" @endif href="{{ $item->url() }}">
            {!! $item->title !!}
            @if($item->hasChildren()) <b class="caret"></b> @endif
        </a>
        @else
            {!! $item->title !!}
        @endif
        @if($item->hasChildren())
            <ul class="dropdown-menu">
                @foreach($item->children() as $child)
                    <li><a href="{{ $child->url() }}">{!! $child->title !!}</a></li>
                @endforeach
            </ul>
        @endif
    </li>
    @if($item->divider)
        <li{{\HTML::attributes($item->divider)}}></li>
    @endif
@endforeach
otrishyn commented 9 years ago

Template is just an example Using icons it's great, but what about special chars or umlauts... Every one corrects template for his needs :-)

ikhrome commented 9 years ago

@alexey-fut I know, that this is just an example :smile: I need to let someone to find a solution and not to get stuck, especially newbies.

kaidesu commented 9 years ago

Thanks for pointing this out. I added a note to the icons wiki page here https://github.com/caffeinated/menus/wiki/Icons