NO BUG: When construct or init in element is used, settings in fronted are not loaded

Version: 1.11.1.1

When construct or init in element class are used, settings in fronted are not loaded.

Constructor in code:
image

Frontend:
image

No constructor in code:
image

Frontend:
image

Same when init is used.

Hi.

What is the reason/what you want to achieve, when you use construct? I believe you are creating new element, right?

In this specific case I want to use hook for Bricks element.

add_action(‘woocommerce_before_add_to_cart_button’, [$this, ‘render_above_cart’]);

If it’s not allowed to use constructor or init “by design”, it would be nice to have it mentioned in documentation. Because it took me half a day to understand that I’m not a camel, and it’s problem in Bricks, not in my constructor. :slight_smile:

Can you try with a constructor like this:

public function __construct($element = null)
    {
        parent::__construct($element);
    }

I guess that should run.

Yes, this way it works.

Please, add it to the element creation documentation here: Create Your Own Elements – Bricks Academy