Step 6: Panel actions

Introduction

The Panel actions file contains the receiving ends for all the panel events and interactions, e.g. an item update action, an item delete action, etc.

Each one of these actions is implemented as a method inside the panel actions file. Such methods must be called “execute” + “action name”, e.g. “executeAddRow()”.

Action methods should accept the event data argument, containing input from the UI (e.g. attributes, item id, etc.).

Code example

class BasicappPanelActions extends \Innomatic\Desktop\Panel\PanelActions {
    public function __construct(\Innomatic\Desktop\Panel\PanelController $controller) {
        parent::__construct($controller);
    }
    public function beginHelper() {}
    public function endHelper() {}
 
  public function executeDeleteItem($eventData) {
    $this->dataAccess->execute(‘DELETE FROM my_items WHERE ID=‘.$eventData[‘id’]);
  }
}

Helpers

The panel view actions also supports a begin and end helper that are called just before and after a view is executed.

public function beginHelper() {
    $this->localeCatalog = new \Innomatic\Locale\LocaleCatalog(
        'example-basic-app::panel',
        $this->container->getCurrentUser()->getLanguage()
    );
}
 
public function endHelper() {
}

Next: Step 7: Web User Interface (WUI)