Skip to content

pipe() method #116

@vjik

Description

@vjik

Proposed new feature or change

Based on yiisoft/yii-widgets#147

Adds pipe(callable $callback) widgets via trait or directly to Widget class. Passes the widget through the callback and returns the result, keeping the fluent chain intact.

$tailwindNav = fn(Menu $m) => $m->class('flex space-x-4')->linkClass('px-3 py-2 rounded-md');

Menu::widget()
    ->items($items)
    ->pipe($tailwindNav)
    ->render();

Reusable configuration (themes, style presets) can be extracted into callables and composed without subclassing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions