Support

Account

Home Forums ACF PRO View Parameter Values in acf/fields/flexible_content/layout_title Filter

Solved

View Parameter Values in acf/fields/flexible_content/layout_title Filter

  • I’m testing out the new acf/fields/flexible_content/layout_title filter and I’m just wondering if there’s a way to dump the values of the parameters ($title, $field, $layout, $i) that are passed to the filter? Is there anyway I can output these values so I can see what’s inside of them. It seems the filter is being triggered via AJAX so maybe I’d have to send this to the console somehow? You can do a var_dump on the strings and it will output where the title goes, but arrays are not. I hope this makes sense. Thanks! Also, while I’m here, it would be really cool if there was a filter for repeater field labels.

  • Hi @leclaeli

    I believe you can just dump it like this:

    function my_acf_flexible_content_layout_title( $title, $field, $layout, $i ) {
        
        echo '<pre>';
        var_dump($title);
        var_dump($field);
        var_dump($layout);
        var_dump($i);
        echo '</pre>';
        
        
        // return
        return $title;
        
    }
    
    // name
    add_filter('acf/fields/flexible_content/layout_title/name=my_flex_field', 'my_acf_flexible_content_layout_title', 10, 4);

    The problem with repeater field is that there’s no place to put the title. If you want, you can use the message field and modify the value by using the acf/load_value filter.

    I hope this helps 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.