elburgl69 Posted August 21, 2020 Share Posted August 21, 2020 (edited) I developed a module supporting the WidgetInterface. The interface requires me to implement also: public function getWidgetVariables($hookName, array $configuration); However, the module does not need to get Widget Variables. So I have the method return an empty array, but then the validator complains in the Optimizations section that $hookName and $configuration are not used. To overcome this I have now implemented as below. Does anybody know of a better solution? public function getWidgetVariables($hookName = null, array $configuration = []) { if (is_null($hookName) && is_array($configuration)) { return []; } else { return []; } } Edited August 25, 2020 by elburgl69 (see edit history) Link to comment Share on other sites More sharing options...
coeos.pro Posted August 21, 2020 Share Posted August 21, 2020 have you try public function getWidgetVariables() Link to comment Share on other sites More sharing options...
elburgl69 Posted August 21, 2020 Author Share Posted August 21, 2020 No Validation error, but upon installing the module I get the following: Compile Error: Declaration of LveProductCmsTabs::getWidgetVariables() must be compatible with PrestaShop\PrestaShop\Core\Module\WidgetInterface::getWidgetVariables($hookName, array $configuration) Link to comment Share on other sites More sharing options...
JBW Posted August 24, 2020 Share Posted August 24, 2020 You have to use same declaration as from the interface, so use public function getWidgetVariables($hookName = null, array $configuration = []) {} On 8/21/2020 at 9:55 AM, elburgl69 said: in the Optimizations section that $hookName and $configuration are not used These are only optimizations warnings, can be ignored Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now