Actions:
Wonderful Relations Actions are our default way to register ajax functions. So the client calls an standardized ,… and it gets a callback
Callback Types:
- CALLBACK_TYPE_MODAL = 0;
- CALLBACK_TYPE_STRING = 1;
- CALLBACK_TYPE_TEMPLATE = 2;
- CALLBACK_TYPE_FILE = 3;
- CALLBACK_TYPE_DATA = 4;
- CALLBACK_TYPE_SCRIPT = 5;
- CALLBACK_TYPE_MESSAGE = 6;
Minimal Implementation:
class YourClassName implements ActionTypeCallback {
public function __construct() {
new ActionType( "return_text", $this, Constants::CALLBACK_TYPE_MODAL );
}
public function execute_callback(): string {
return "TEXT";
}
}
Example Action Callback: Reload DataTable
return array(
Constants::CALLBACK_TYPE_SCRIPT,
"jQuery('#{$this->payload["datatable_identifier"]}').DataTable().ajax.reload()");