Skip to content

Plugin (Trigger) ​

This is executed when a specific operation is performed on the screen of Exment, and processing such as updating the value can be performed.
Alternatively, you can add a button to the list screen or form screen and process it when clicked.
Specific operations include the following:

Trigger type ​

NameTypeDescription
savingImmediately before savingThe process starts immediately before saving the data.
savedAfter savingAfter saving the data, the process starts.
grid_menubuttonMenu button on the list screenAdd a button at the top of the data list screen to generate an event when clicked.
form_menubutton_showMenu button on data detail screenAdd a button at the top of the data detail screen to generate an event when clicked.
form_menubutton_createMenu button on new data creation screenAdd a button at the top of the new data creation screen to generate an event when clicked.
form_menubutton_editMenu button on data update screenAdd a button at the top of the data update screen to fire an event when clicked.
workflow_action_executingImmediately before workflow executionProcessing starts immediately before the workflow is executed.
workflow_action_executedAfter executing the workflowAfter the workflow is executed, the process starts.

How to make ​

Create config.json ​

  • Create the following config.json file.
json
{
    "plugin_name": "PluginDemoTrigger",
    "uuid": "fa7de170-992a-11e8-b568-0800200c9a66",
    "plugin_view_name": "Plugin Trigger",
    "description": "Plugin upload test",
    "author": "(Your Name)",
    "version": "1.0.0",
    "plugin_type": "trigger",
    "event_triggers": "loaded,loading",

}
  • plugin_name should be written in alphanumeric characters.
  • uuid is a character string of 32 characters + hyphen, totaling 36 characters. Used to make the plugin unique.
    Please create from the following URL etc.
    https://www.famkruithof.net/uuid/uuidgen
  • plugin_type should be written as trigger.
  • When specifying event_triggers from the beginning, enter the names of "trigger types" separated by commas.
  • When specifying target_tables from the beginning, enter the table names of custom tables separated by commas.

PHP file creation ​

  • Create the following PHP file. The name should be "Plugin.php".
php
<?php
namespace App\Plugins\PluginDemoTrigger;

use Exceedone\Exment\Services\Plugin\PluginTriggerBase;
class Plugin extends PluginTriggerBase
{
    /**
     * Plugin Trigger
     */
    public function execute()
    {
        admin_toastr('Plugin calling');
        return true;
    }
}
  • namespace should be App \ Plugins (plugin name).

  • When the conditions of the trigger registered in the plugin management screen are met, the plugin is called and the execute function in Plugin.php is executed.

  • The Plugin class inherits the class PluginTriggerBase.
    PluginTriggerBase has properties such as the custom table $ custom_table and table value $ custom_value of the caller, and when the execute function is called, the value is assigned to the property.
    See the plugin reference for details on the properties.

Compress to zip ​

Compress the above two files into a zip with the minimum configuration.
The zip file name should be "(plugin_name) .zip".

  • PluginDemoTrigger.zip
    • config.json
    • Plugin.php
    • (Other required PHP files, image files, etc.)

Sample plugin ​

in preparation...