Simple File List includes numerous hooks you can use in order to extend its functionality and integration with your theme or other plugins. In addition knowing when an action occurred, SFL custom hooks also return an array containing messages related to the action process.
File Uploads Hooks
These hooks will fire after a successful file upload job. There is one for the front-end and one for the back-end.
eeSFL_Hook_Uploaded
eeSFL_Admin_Hook_Uploaded
How to Use the Hooks
To make your theme do something special when SFL fires hooks, add something like this to your child theme’s functions.php file.
// add_action('The Hook Name', 'Your Function Name', Priority, Number of Arguments)
add_action('eeSFL_Hook_Uploaded', 'eeHookTestOutput', 10, 1);
Then write a function to do whatever you want when the action occurs and the hook is fired.
// When the hook is fired, add_action() calls this function
// Writes output to /wp-content/debug.log
function eeHookTestOutput($eeMessages) {
error_log('Hook Fired');
foreach($eeMessages as $eeMessage) {
error_log($eeMessage);
}
}
More Hooks
SFL is List is Loaded
This hook will fire each time the file list is loaded. The messages array will contain the URL of the list page and how many items were shown.
eeSFL_Hook_Loaded
SFL is Item is Listed
This hook will fire each time a file or folder(Pro) is listed. The messages array will contain the file array, which contains all of the details for the item.
eeSFL_Hook_Listed
New Item Added
This hook will fire each time a new item (one that was added from outside the plugin) is found during the re-scan process.
eeSFL_Hook_Added
Item Not Found
This hook will fire each time an item is no longer found in the list, and was removed from outside of the plugin.
eeSFL_Hook_Removed
Item was Edited
This hook will fire each time an item has been edited. The message array will give info about what happened.
eeSFL_Hook_Edited
Item was Deleted
This hook will fire each time an item has been deleted. The message array will give the name of the file deleted.
eeSFL_Hook_Deleted
Item was Moved
This hook will fire each time an item has been moved. The message array will give the before and after path.
eeSFL_Hook_Moved
List was Scanned
This hook will fire each time the disk was re-scanned. The message array will give info about what happened.
eeSFL_Hook_Scanned
Hooks are cool! If you need one for something in your project, please let me know!