Jump to content

Edit History

elburgl69

elburgl69

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 [];
        }
    }

 

elburgl69

elburgl69

I developed a module supporting the WidgetInterface. The interfacer 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 [];
        }
    }

 

×
×
  • Create New...