Skip to content

Fatal error: Class 'Vendor\Module\Block\Form\Entity\GenericButton' not found in app/code/Vendor/Module/Block/Adminhtml/Form/Button.php #2555

Open
@ioweb-gr

Description

@ioweb-gr

Describe the bug (*)

I've created a form with the form ui component tool however the form is not usable due to a Fatal Error.

The button added tries to extend Block\Form\Entity\GenericButton but that class is not created by the plugin.

THis is what the button code looks like

<?php
/**
 * Copyright (c) 2025. YourCompanyName
 */

namespace Vendor\ModuleName\Block\Adminhtml\Form;

use Vendor\ModuleName\Block\Form\Entity\GenericButton;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;

/**
 * Save entity button.
 */
class Button extends GenericButton implements ButtonProviderInterface
{
    /**
     * Retrieve Save button settings.
     *
     * @return array
     */
    public function getButtonData(): array
    {
        return $this->wrapButtonSettings(
            __('Save')->getText(),
            'save primary',
            '',
            [
                'mage-init' => ['button' => ['event' => 'save']],
                'form-role' => 'save'
            ],
            30
        );
    }
}

To Reproduce (*)

Steps to reproduce the behavior:

  1. Go to New
  2. Click on Magento 2 UI Compoent form
  3. Make sure to add a button
  4. Try to visit the controller URL to render the form
  5. See the Fatal Error

Expected behavior (*)

There's no error and the Generic Button class exists.

Screenshots

If applicable, add screenshots to help explain your problem.

Please complete the following information: (*)

  • OS: Windows 11 x64
  • PhpStorm/Intellij version: 2025.1.1
  • Plugin Version: 2025.1.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions