Fetch Supported Driver
public function onFetchSupportedExportDrivers() : array
Fires while loading the list of supported exporting drivers.
Description
Trigger hook to let the plugins register external drivers to export the restaurant reservations and take-away orders.
This filter should simply return a list of paths to include (as drivers) within the script. The base name of the files to load can specify only letters, numbers and underscores.
Note: at the first execution of the hook the $drivers
argument isn't an array
.
Return Value
-
Array. The array holding the files of the external drivers to load.
Example
The example below adds support for all the drivers contained in a specific folder of the plugin. Such as:
/plugins/vikrestaurants/e4j/drivers/
All the PHP
files contained within the drivers folder of the VikRestaurants - E4J plugin will be loaded.
/**
* Trigger hook to let the plugins register external drivers
* as supported exporters.
*
* @return array $drivers The array holding the drivers to load.
*/
public function onFetchSupportedExportDrivers($drivers)
{
// create base path to "drivers" folder contained within the plugin
$base = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'drivers' . DIRECTORY_SEPARATOR;
// load all PHP files from "drivers" folder
return glob($base . '*.php');
}
Changelog
Version | Description |
---|---|
1.8 | Introduced. |
Last Update: 2023-12-29 14:15
Helpful?