<?php

namespace Plainwork\UiWordPress\Renderer\Form;

use Plainwork\Http\Request;
use Plainwork\Ui\Component\Form\Button;

class FrontButtonRendererDecorator
{
    public function __invoke(Button $el, Request $request, callable $next)
    {
        // $el->withAttr('class', 'button');

        $isPrimary = $el->isPrimary();
        if ($isPrimary) {
            $el->withAttr('class', 'button-primary');
            $el->withAttr('class', 'wp-element-button');
        }

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