Define User Action
UI Integration
Arguments
Crud integration

Agile UI introduces a new set of views called "User Action Executors". Their job is to recognise all that meta-information that you have specified for the user action and requesting it from the user. "edit" user action is defined for models by default and you can trigger it on button-click with a very simple code:

$country = new \atk4\ui\demo\CountryLock($app->db);
$country->loadAny();

\atk4\ui\Button::addTo($app, ['Edit some country'])
    ->on('click', $country->getUserAction('edit'));
Edit some country

It is not only the button, but any view can have "User Action" passed as a second step of the on() call. Here the user action is executed when you click on "World" menu item:

$country = new \atk4\ui\demo\CountryLock($app->db);
$country->loadAny();

$menu = \atk4\ui\Menu::addTo($app);
$menu->addItem('Hello');
$menu->addItem('World', $country->getUserAction('edit'));