How to properly expose CPT custom fields to Bricks as dynamic data (so they're visible in dropdown)?

Hello! I am working on a plugin that creates a CPT and it has some custom fields.

I can get as far as getting the dynamic tags to work in Bricks (if I type them manually). :+1:

But I can’t get them to show up in the dropdown yet.

I notice custom fields from custom posts created by a plugin like Pods or CPTUI seem to show up in Bricks, so I must be doing something “wrong.”

Here is what I have tried so far (register and expose fields with the REST API):

// Register meta fields with REST API
function erw_register_meta_fields() {
    $meta_keys = array(
        'ewr_event_start_date' => 'Event Start Date',
        'ewr_event_end_date' => 'Event End Date',
        'ewr_event_start_time' => 'Event Start Time',
        'ewr_event_end_time' => 'Event End Time',
        'ewr_ticket_price' => 'Ticket Price',
        'ewr_max_ticket_quantity' => 'Max Ticket Quantity',
        'ewr_ticket_addon' => 'Ticket Add-on'

    foreach ($meta_keys as $meta_key => $description) {
        register_post_meta('event', $meta_key, array(
            'type' => 'string',
            'description' => $description,
            'single' => true,
            'show_in_rest' => array(
                'schema' => array(
                    'type' => 'string',
                    'context' => array('view', 'edit', 'embed'),
            'auth_callback' => function() {
                return current_user_can('edit_posts');
add_action('init', 'erw_register_meta_fields');

// Expose custom fields in REST API response
function erw_expose_custom_fields_in_rest($response, $post, $request) {
    if ($post->post_type === 'event') {
        $meta_fields = array(

        foreach ($meta_fields as $meta_field) {
            $meta_value = get_post_meta($post->ID, $meta_field, true);
            if (!empty($meta_value)) {
                $response->data['meta'][$meta_field] = $meta_value;

    return $response;
add_filter('rest_prepare_event', 'erw_expose_custom_fields_in_rest', 99, 3);

Is there something else I need to do? I hope I don’t need to make these full-blown dynamic data tags as well just to see them in the dropdown (is this what e.g. Pods, CPT UI ad nother plugins are doing? It doesn’t seem so)—I would hope/think Bricks knows how to see custom fields when they are properly presented, and it’s just me who doesn’t know enough yet…