laravel-widgets icon indicating copy to clipboard operation
laravel-widgets copied to clipboard

Add getter of $widgets to WidgetGroup

Open nejtr0n opened this issue 6 years ago • 2 comments

Hello. Sometimes we need to have extra logic with widget groups. For example, make tabs fo them.

                    <ul class="nav nav-tabs" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" data-toggle="tab" href="{{ $widget[1] }}" role="tab" aria-controls="home"> {{ $widget["name"] }}</a>
                        </li>
                    </ul>
<div class="tab-content">
{{ Widget::group('group')->display() }}
</div>

So we need to loop over widgets in group. It would be great to have getter or use Macroable trait on Widget group.

nejtr0n avatar Apr 28 '18 09:04 nejtr0n

The idea to make widgets in group iteratable is cool, but it's not easy due to internal widget group implementation widgets in a group are instantiated and sorted only in display() method. This implementation can probably be changed without big BC breaks though

arrilot avatar May 06 '18 17:05 arrilot

I understand. Thank you for reply.

nejtr0n avatar May 07 '18 16:05 nejtr0n