Adapt manual to new Dialogs interface
Adapt manual to new Dialogs interface
Previously in FusionDirectory most dialog/pages were respecting a kind of unmentioned interface, with functions save_object and execute.
Supposedly save_object read the POST and update the values accordingly, and execute executes the logic and renders the HTML for this dialog. In the end there was some logic in save_object and some logic in execute. This lead to weird situation in things like import and webservice, as we had to call save_object is some cases even if there is no POST to read, and we had to call execute even if we do not use the rendered HTML. Also there were inconsistencies in the signatures for the functions.
Now (see fd#6072) all dialog/pages classes in FusionDirectory implements the FusionDirectoryDialog
interface:
/*! \brief This interface should be implemented by all dialog classes in FusionDirectory
*/
interface FusionDirectoryDialog
{
/*! \brief Interpret POST content
*/
public function readPost ();
/*! \brief Update state and return FALSE if the dialog was closed
*/
public function update (): bool;
/*! \brief Render the dialog and returns the HTML code
*/
public function render (): string;
}
This means that when modifying values in a non-interactive way (import,webservice,templates) you modify the values and only call update
.
The update function has a boolean return value indicating if the dialog is still open which is only used for sub-dialogs. Other classes should always return TRUE.
Note that management
kind of cheat and renders in readPost
, because it needs to react to the action in POST if there is one. But it still respect the interface and this is not a problem from outside the class.