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?


So, something like:


1 Answer 1


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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.