<?php

namespace Plainwork\UiWordPress\Renderer;

use Plainwork\Http\Request;
use Plainwork\Ui\Component\Link;

class AdminNavRenderer
{
    public function __invoke(Nav $el, Request $request, callable $next)
    {
        $items = $el->getItems();
        foreach ($items as $item) {
            if ($item instanceof Link) {
                $item->withAttr('class', 'page-title-action');
            }
        }

        return $next($el, $request);
    }
}
