<?php

add_action('agreable_app_theme_init', function () {
    $key = 'partnership';
    include_once get_template_directory() . "/custom-fields/WidgetLoader.php";
    $widgets = WidgetLoader::findByUsage('partnership');
    register_field_group(array('key' => $key . '_widgets_group', 'title' => 'Body', 'fields' => array(array('key' => $key . '_widgets', 'label' => 'Content Widgets', 'name' => 'widgets', 'prefix' => '', 'type' => 'flexible_content', 'instructions' => 'The body of the content is built up with widgets', 'required' => 1, 'conditional_logic' => 0, 'button_label' => 'Add Widget', 'min' => 1, 'max' => '', 'layouts' => $widgets)), 'location' => array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'partnership'))), 'menu_order' => 2, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => array(0 => 'the_content', 1 => 'discussion', 2 => 'comments')));
});
<?php

include_once __DIR__ . "/../WidgetLoader.php";
$content_widgets = WidgetLoader::findByUsage("post");
$widgets_acf = array('key' => 'widgets_group', 'title' => 'Body', 'fields' => array(array('key' => 'post_widgets', 'label' => 'Content Widgets', 'name' => 'widgets', 'prefix' => '', 'type' => 'flexible_content', 'instructions' => 'The body of the content is built up of widgets', 'required' => 1, 'button_label' => 'Add Widget', 'min' => 1, 'layouts' => $content_widgets)), 'location' => array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'post'))), 'menu_order' => 2, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label');
$widgets_acf = apply_filters('agreable_base_theme_widgets_acf', $widgets_acf);
register_field_group($widgets_acf);
<?php

add_action('agreable_app_theme_init', function () {
    $key = 'longform';
    include_once get_template_directory() . "/custom-fields/WidgetLoader.php";
    $widgets = WidgetLoader::findByUsage('longform');
    register_field_group(array('key' => $key . '_widgets_group', 'title' => 'Body', 'fields' => array(array('key' => $key . '_widgets', 'label' => 'Content Widgets', 'name' => 'widgets', 'prefix' => '', 'type' => 'flexible_content', 'instructions' => 'The body of the content is built up with widgets', 'required' => 1, 'conditional_logic' => 0, 'button_label' => 'Add Widget', 'min' => 1, 'max' => '', 'layouts' => $widgets)), 'location' => array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'longform'))), 'menu_order' => 2, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => array(0 => 'the_content', 1 => 'discussion', 2 => 'comments')));
});
<?php

if (!function_exists('register_field_group')) {
    return;
}
$contextType = "category";
include_once __DIR__ . "/../WidgetLoader.php";
$widget_layouts_main = WidgetLoader::findByUsage("category", "main");
$widget_layouts_sidebar = WidgetLoader::findByUsage("category", "sidebar");
$category_widgets_acf = array('key' => 'category_widgets_group', 'title' => 'Category widgets', 'fields' => array(array('key' => 'category_widgets', 'label' => 'Category Widgets', 'name' => 'widgets', 'prefix' => '', 'type' => 'flexible_content', 'instructions' => 'The widgets that make up this category', 'required' => 0, 'button_label' => 'Add Widget', 'min' => 1, 'layouts' => $widget_layouts_main)), 'location' => array(array(array('param' => 'taxonomy', 'operator' => '==', 'value' => 'category')), array(array('param' => 'post_type', 'operator' => '==', 'value' => 'page'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => array(0 => 'the_content'));
$category_widgets_acf = apply_filters('agreable_base_theme_category_widgets_acf', $category_widgets_acf);
register_field_group($category_widgets_acf);