Feature request / help: layout assignment condition for pages that are using Cornerstone

Hey there!
Loving the latest release and everything it brings.

I have a (hopefully) quick request regarding setting up layout assignments for pages that are built with Cornerstone vs using the WP Blocks editor.

Previously, I had set up a custom conditional that simply checked the content of a page / post for the cs_content shortcode, which worked great for setting up a different layout for some pages (mostly legal pages, privacy policy etc). This is the current function I have for the assignment condition:

function cxx_condition_rule_content_builder() {
    return has_shortcode( get_the_content(), 'cs_content' );
}

Now that Pro sites are migrating to use html storage, Iā€™m wondering if there is another way I could achieve a similar thing? E.g. what checks are being applied to decide whether to show the Edit in Cornerstone splash page when editing a page? Could those same checks be wrapped in a conditional for layout assignments? Alternatively, should I just check the post content for the opening <!-- cs-content --> comment?

I would be glad to hear your thoughts!

Cheers,
Jakob

Hello Jakob,

Yes, you can look for the <! ā€“ cs-content ā€“ > comment in the post_content.

function cxx_condition_rule_content_builder() {
    return strpos(get_the_content(), '<!-- cs-content -->') !== false;
}

Another option is to use the cs_uses_cornerstone function which checks if a post uses the builder.

if ( cs_uses_cornerstone( $post ) ) { }

Let us know if you need additional info.

Kind regards.