I’m using flexible content to create a page builder, and designing each block as a component. Some blocks have a lot of options and I’m just wondering if something like this:
$id = get_sub_field(‘id’);
$class = get_sub_field(‘class’);
$minHeight = get_sub_field(‘min_height’);
$height = get_sub_field(‘full_height’);
$mobile = get_sub_field(‘mobile’);
$media = get_sub_field(‘media’);
$content = get_sub_field(‘content’);
$cta = get_sub_field(‘cta’);
$buttonType = get_sub_field(‘button_type’);
$link = get_sub_field(‘link’);
$scrollIcon = get_sub_field(‘scroll_icon’);
$anchor = get_sub_field(‘anchor’);
…at the top of each component is going to be noticeably slower than, say:
$blockGroup = get_sub_field('block_group');
…and then accessing each value like:
$blockGroup['id']
The bottom line is a group created yet another nest inside the flexible row, and just not as neat as having the fields loose in there. Thoughts welcome.
There shouldn’t be any noticeable performance change.
When a post is set up all of it’s meta data should be in the cache and only PHP is used to get the values from the cache.