Problem with the order in the array for the filter bricks/builder/elements (Fatal Error)

I have noticed some problems in the bricks/builder/elements filter. An array with the corresponding element IDs is needed as return value. However, the order seems to be significant… I have found the following problems:

  1. If the element “container” does not have index 0 in the array, a Fatal Error is generated:
    Fatal error: Uncaught Error: Cannot instantiate abstract class Bricks\Element in …wp-content/themes/bricks/includes/elements.php:161
    This leads to the fact that we partially cannot influence the order of the output elements.

  2. For the nested elements, e.g. ‘section’, the same FATAL error is also output if the corresponding dependencies are not in the array. Here it might make more sense to simply add the dependency to the array afterwards, should it not be present.

In the following I send you a few array examples, so that the whole thing is comprehensible:

add_filter( 'bricks/builder/elements', 'render_elements_example');
function render_elements_example($elements) {
  return ['section', 'container'] // FATAL ERROR, because the "container" has not index 0
  return ['container', 'section'] // This works
  return ['section', 'heading'] // FATAL ERROR, because the "section" dependency "container" not exists in the array
}

–EDIT–
In the meantime I think that the thing with the dependencies does not apply at all, but it is really only due to the index of the container.

Thanks in advance for checking it out! :slight_smile: