Uniform - Trouble adding custom action


I’m having trouble adding a custom action to the Uniform plugin. I think I’m missing something basic here:

  1. I created the file uniform-actions.php in site/plugins

  2. The content of the file:

       namespace Uniform\Actions;
       class BlaBlaBla extends Action
               public function perform()
                   try {
                   } catch (\Exception $e) {
  3. Then I call the new action with
    if (r::is(‘POST’)) {

However nothing happens and the new action is not found. If I use the standard DumpAction instead everything works fine. What am I missing here?

It is also not working if I place the plugin file in a /uniform-actions subdirectory.

I installed Uniform as a git submodule.

Thank you!

If you want to be able to call the action via a magic method it must have the Action suffix in its name. This information was missing from the docs, I’ve fixed that.

So call your class BlaBlaBlaAction and it should work with $form->blaBlaBlaAction(). The other methods to execute an action will always work, no matter what your custom action is called.

1 Like

Thank you – that did the trick!