Pre- and Post-Controllers in Venddor IO

Understanding Pre-Controllers and Post-Controllers

In the ecosystem of Venddor IO, pre-controllers and post-controllers play a distinctive role. These are specific PHP files linked to a module, which, based on their naming conventions and positioning within the module's directory structure, are executed either before or after the primary standard controller's operation.

Illustrative Example

Within the /controllers/backend or /controllers/frontend directories of a module, such as the "Attachments" module, there may exist a file named products.post.php.

Files residing in these directories either act as standalone controllers for the module or function as pre-/post-controllers for the standard controllers.

A pre- or post-controller file typically follows this naming convention:

[controller name].[pre/post].php

Given that a controller named "products" is a standard fixture, the module is limited to creating only its pre- or post-controllers.

The .post in the filename signifies that this file will be executed following the execution of the standard "products" controller. To trigger its operation before the standard controller, you would replace .post with .pre.