From 89f734adf1ffefc5619c8519a8a8b2fc147cdad4 Mon Sep 17 00:00:00 2001 From: Mika Date: Wed, 16 Mar 2022 17:21:57 +0200 Subject: [PATCH 1/2] enable layouts and gutenberg block --- lib/ACF/PageGroup.php | 40 +++--- lib/BlocksController.php | 292 +++++++++++++++++++-------------------- 2 files changed, 166 insertions(+), 166 deletions(-) diff --git a/lib/ACF/PageGroup.php b/lib/ACF/PageGroup.php index 44245826..7bb8be95 100644 --- a/lib/ACF/PageGroup.php +++ b/lib/ACF/PageGroup.php @@ -150,26 +150,26 @@ protected function get_components_field( string $key ) : Field\FlexibleContent { $component_layouts = apply_filters( 'tms/acf/field/' . $components_field->get_key() . '/layouts', [ - // Layouts\ImageBannerLayout::class, - // Layouts\CallToActionLayout::class, - // Layouts\ContentColumnsLayout::class, - // Layouts\LogoWallLayout::class, - // Layouts\MapLayout::class, - // Layouts\IconLinksLayout::class, - // Layouts\SocialMediaLayout::class, - // Layouts\ImageCarouselLayout::class, - // Layouts\SubpageLayout::class, - // Layouts\TextBlockLayout::class, - // Layouts\GridLayout::class, - // Layouts\EventsLayout::class, - // Layouts\ArticlesLayout::class, - // Layouts\BlogArticlesLayout::class, - // Layouts\SitemapLayout::class, - // Layouts\NoticeBannerLayout::class, - // Layouts\GravityFormLayout::class, - // Layouts\ContactsLayout::class, - // Layouts\AccessibilityIconLinksLayout::class, - // Layouts\ShareLinksLayout::class, + Layouts\ImageBannerLayout::class, + Layouts\CallToActionLayout::class, + Layouts\ContentColumnsLayout::class, + Layouts\LogoWallLayout::class, + Layouts\MapLayout::class, + Layouts\IconLinksLayout::class, + Layouts\SocialMediaLayout::class, + Layouts\ImageCarouselLayout::class, + Layouts\SubpageLayout::class, + Layouts\TextBlockLayout::class, + Layouts\GridLayout::class, + Layouts\EventsLayout::class, + Layouts\ArticlesLayout::class, + Layouts\BlogArticlesLayout::class, + Layouts\SitemapLayout::class, + Layouts\NoticeBannerLayout::class, + Layouts\GravityFormLayout::class, + Layouts\ContactsLayout::class, + Layouts\AccessibilityIconLinksLayout::class, + Layouts\ShareLinksLayout::class, ], $key ); diff --git a/lib/BlocksController.php b/lib/BlocksController.php index 6afd9239..abcdb9be 100644 --- a/lib/BlocksController.php +++ b/lib/BlocksController.php @@ -135,152 +135,152 @@ private function allowed_block_types( $allowed_blocks, $context ) { '', ], ], - // 'acf/image-banner' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/key-figures' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/link-list' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/quote' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/grid' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // ], - // ], - // 'acf/accordion' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/video' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/image' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/video' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\DynamicEvent::SLUG, - // PostType\BlogArticle::SLUG, - // ], - // ], - // 'acf/image-gallery' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/image-carousel' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/share-links' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/table' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/material' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/subpages' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // ], - // ], - // 'acf/notice-banner' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'acf/map' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\DynamicEvent::SLUG, - // PostType\BlogArticle::SLUG, - // ], - // ], - // 'acf/contacts' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\DynamicEvent::SLUG, - // PostType\BlogArticle::SLUG, - // ], - // ], - // 'acf/acc-icon-links' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\BlogArticle::SLUG, - // PostType\DynamicEvent::SLUG, - // ], - // ], - // 'gravityforms/form' => [ - // 'post_types' => [ - // PostType\Page::SLUG, - // PostType\Post::SLUG, - // PostType\Contact::SLUG, - // ], - // ], + 'acf/image-banner' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/key-figures' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/link-list' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/quote' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/grid' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + ], + ], + 'acf/accordion' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/video' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/image' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/video' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\DynamicEvent::SLUG, + PostType\BlogArticle::SLUG, + ], + ], + 'acf/image-gallery' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/image-carousel' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/share-links' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/table' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/material' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/subpages' => [ + 'post_types' => [ + PostType\Page::SLUG, + ], + ], + 'acf/notice-banner' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'acf/map' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\DynamicEvent::SLUG, + PostType\BlogArticle::SLUG, + ], + ], + 'acf/contacts' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\DynamicEvent::SLUG, + PostType\BlogArticle::SLUG, + ], + ], + 'acf/acc-icon-links' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\BlogArticle::SLUG, + PostType\DynamicEvent::SLUG, + ], + ], + 'gravityforms/form' => [ + 'post_types' => [ + PostType\Page::SLUG, + PostType\Post::SLUG, + PostType\Contact::SLUG, + ], + ], ]; $blocks = apply_filters( From 4e52d8aac95dc739151b47f4ba100c45ae94088d Mon Sep 17 00:00:00 2001 From: Viljami Hirvonen Date: Mon, 9 May 2022 15:36:41 +0300 Subject: [PATCH 2/2] Update pagegroup layouts --- lib/ACF/PageGroup.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/ACF/PageGroup.php b/lib/ACF/PageGroup.php index 7bb8be95..e03fd77c 100644 --- a/lib/ACF/PageGroup.php +++ b/lib/ACF/PageGroup.php @@ -75,6 +75,11 @@ protected function register_fields() : void { 'operator' => '!=', 'value' => \PageEventsSearch::TEMPLATE, ], + [ + 'param' => 'page_template', + 'operator' => '!=', + 'value' => \PageProgram::TEMPLATE, + ], [ 'param' => 'page_type', 'operator' => '!=', @@ -150,25 +155,26 @@ protected function get_components_field( string $key ) : Field\FlexibleContent { $component_layouts = apply_filters( 'tms/acf/field/' . $components_field->get_key() . '/layouts', [ - Layouts\ImageBannerLayout::class, Layouts\CallToActionLayout::class, - Layouts\ContentColumnsLayout::class, + Layouts\ImageBannerLayout::class, + Layouts\GridLayout::class, + // Layouts\ContentColumnsLayout::class, Layouts\LogoWallLayout::class, - Layouts\MapLayout::class, Layouts\IconLinksLayout::class, + Layouts\MapLayout::class, Layouts\SocialMediaLayout::class, Layouts\ImageCarouselLayout::class, Layouts\SubpageLayout::class, Layouts\TextBlockLayout::class, - Layouts\GridLayout::class, - Layouts\EventsLayout::class, + // Layouts\EventsLayout::class, Layouts\ArticlesLayout::class, - Layouts\BlogArticlesLayout::class, + // Layouts\BlogArticlesLayout::class, Layouts\SitemapLayout::class, - Layouts\NoticeBannerLayout::class, + // Layouts\NoticeBannerLayout::class, Layouts\GravityFormLayout::class, Layouts\ContactsLayout::class, - Layouts\AccessibilityIconLinksLayout::class, + // Layouts\AccessibilityIconLinksLayout::class, + Layouts\CountdownLayout::class, Layouts\ShareLinksLayout::class, ], $key