Support

Account

Home Forums Feature Requests Flexible content blocks – friendly/custom collapsed name

Solving

Flexible content blocks – friendly/custom collapsed name

  • Hello,

    First off, great work on ACF – don’t know what we’d do without it.

    When using flexible content blocks there is, however, an issue viewing the content especially when you’re adding multiple blocks of the same type.

    The attached screen grab shows 9 flexible text blocks, when collapsed for re-ordering there is no way to tell which is which. When using a repeater block there is the facility to define what field (if any) is displayed when collapsed, this feature would make re-ordering flexible blocks much easier if ported to flexible content blocks.

    Alternatively if it were possible to have a CMS only field where you could give the blocks a friendly name that would work very well too.

    Hope you can find a way to work this in.

    Many thanks
    Andy

  • One idea to automate, for each layout you can start with a field labeled “Admin Title” and name it as “layout_title”, then you use this function on your theme functions.php.

    
    function my_layout_title($title, $field, $layout, $i) {
    	if($value = get_sub_field('layout_title')) {
    		return $value;
    	} else {
    		foreach($layout['sub_fields'] as $sub) {
    			if($sub['name'] == 'layout_title') {
    				$key = $sub['key'];
    				if(array_key_exists($i, $field['value']) && $value = $field['value'][$i][$key])
    					return $value;
    			}
    		}
    	}
    	return $title;
    }
    
    add_filter('acf/fields/flexible_content/layout_title', 'my_layout_title'), 10, 4);
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.