Custom Template condition's field not set in the scores hook

Hi there I have a template that renders a ‘notification bar’ at the bottom of the page

The code to add that custom field is

add_filter("builder/settings/template/controls_data", function ($data) {
    // Add control to get the MB custom field that has the selected set of pages
    $data["controls"]["templateConditions"]["fields"]["promoPagesConfig"] = [
        "type" => "text",
        "label" => esc_html__("Promo Pages List", "bricks"),
        "placeholder" => esc_html__(
            "Page level MB custom field name",
            "bricks"
        ),
        "description" => esc_html__(
            "Leave empty to apply template to all pages.",
            "bricks"
        ),
        "required" => ["main", "=", "any"],
    ];

    return $data;
});

However, when I dump the ‘conditions’ object from the bricks/screen_conditions/scores hook, I dont see promoPagesConfig in it. My current scores hook code is:

add_filter(
    "bricks/screen_conditions/scores",
    function ($scores, $condition, $post_id, $preview_type) {
        echo '<hr/><div style="display:grid;grid-template-columns:repeat(4, 1fr);"</div>';
        c_var_dump($scores, "red");
        c_var_dump($condition, "green");
        c_var_dump($post_id, "blue");
        c_var_dump($preview_type, "pink");
        echo "</div><hr/>";
        

        return $scores;
    },
    10,4
);

Can someone help?

Hi @ramnathk ,

Thanks for the email as well.

The bricks/screen_conditions/scores will only be triggered when Bricks choosing template as the active template for a page.

It will not be used for section template hooks injection logic introduced in 1.9.1. There is no available PHP filter hook for this logic currently,

I will record an improvement task for Section template hooks Injection logic for the team.

For the time being, the only way for your scenario is using Element Condition inside the Section template.

Regards,
Jenn

Ah that explains it. Thanks a bunch Jenn