Issue #3364692: Care for unexposed keys in my_pattern.ui_patterns.yml
requested to merge issue/component_blocks-3364692:fix/care_for_unexposed_keys_in__ui_patterns_yml into 1.x
Problem/Motivation
If a ui_pattern plugin does not expose fields, ComponentBlock::getConfiguration()['variables'] with this pattern gives an empty array. In ComponentBlock::build() there's no empty(array) check for this array, thus throws an Error.
Steps to reproduce
- Create a ui_pattern but do not expose the fields section in the plugin-definition file myPattern.ui_pattern.yml
- Add myPattern in Layout_Builder -> you get Warning: foreach() argument must be of type array|object, null given in Drupal\component_blocks\Plugin\Block\ComponentBlock->build() (line 196 of modules/contrib/component_blocks/src/Plugin/Block/ComponentBlock.php).