Is there a way to get all the widget parameters in an array instead of loading the data of a specific widget parameter like below?
$this->getData('widget_parameter_1');
So, something like:
$currentwidgetObject->getParameters();
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityIs there a way to get all the widget parameters in an array instead of loading the data of a specific widget parameter like below?
$this->getData('widget_parameter_1');
So, something like:
$currentwidgetObject->getParameters();
Seems it was fairly easy:
$data = $this->getData();
Gives me an array with the widget type, widget parameters and the module name inside the block class as defined in widget.xml. All i had to to then was use regex to filter out the wanted parameters (which contain a partial common name).
public function filterParameters(){
$data = $this->getData();
$matches = preg_grep("/_col_block_/", array_keys($data));
return array_intersect_key($data, array_flip($matches));
}
If anyone knows a cleaner solution then please share!