Upgrading to v3
If you’ve written a custom Module for CMS version 2.x, you will need to make several code changes to make it work and look correct in CMS version 3.
Please note, we’ve addressed the changes from 1.8 to version 2.x in an earlier page: Upgrading to v2 — please make sure you have done those changes first.
Request/Response objects
In version 3 of the CMS we use PSR request and response objects liberally throughout the application code base. This affects the Module edit and settings methods, which now have the following signature:
/**
* Edit Widget
* @param \Slim\Http\ServerRequest $request
* @param \Slim\Http\Response $response
* @return \Slim\Http\Response
* @throws GeneralException
*/
public function edit(Request $request, Response $response): Response;
/**
* Module Settings
* @param \Slim\Http\ServerRequest $request
* @param \Slim\Http\Response $response
* @throws GeneralException
* @return \Slim\Http\Response
*/
public function settings(Request $request, Response $response): Response;In most cases you will return the $response provided without modification, however you are free to adjust it if necessary, for example to add some headers, or change the return code.
Sanitizer
Version 3 has a new Sanitizer library, which is loaded and accessed in a different way. First get the request parameters using $request->getParams(), then pass those into the Sanitizer and receive back a new Sanitizer object which you can pull sanitized parameters from.
Last updated
Was this helpful?

