0

Question

What do I need to setup a Button's behaviour, or is there CRUD built-in Magento 2 behaviour when I do not specify a Controller?

This is The tutorial article I am following.

I found the github The sample module that seems to be based on the tutorial.

This is The UI compontent config file I am basing my module on.

The relevant section on the 'Add New Post' button (name='add'):

<item name="add" xsi:type="array">
    <item name="name" xsi:type="string">add</item>
    <item name="label" xsi:type="string" translate="true">Add New Post</item>
    <item name="class" xsi:type="string">primary</item>
    <item name="url" xsi:type="string">*/*/new</item>
</item>

The target defined there is */*/new.

I have managed to get the grid working, it shows the InstallSchema/UpgradeSchema changes correctly in the database and in the admin area.

However, it feels like the tutorial isn't explaining everything here. The referenced */*/new resolves to admin/mymoduleroute/user/new

Are there built-in CRUD control handlers ? Like when I press 'New', it uses built-in functionality. As explained, the tutorial doesn't show the Controller part relevant to this (as far as I can see).

I also see this in log file right now:

 Request validation failed for action "Magento\Framework\App\Action\Forward\Interceptor"
 {"exception":"[object] (Magento\\Framework\\App\\Request\\InvalidRequestException(code: 0):
 Invalid request received at /var/www/html/vendor/magento/
module-backend/App/Request/BackendValidator.php:152)"}

Isn't interceptors supposed to built automatically by Magento 2?

I am not in production mode.

2
  • I would really appreciate some assistance :) Jun 15, 2021 at 14:46
  • Same issue here M2.4.2 Aug 31, 2021 at 18:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.