From 5b5a0ab8562cef4b219af8ef8f87f9e6375ef83c Mon Sep 17 00:00:00 2001 From: Sebastian Thulin Date: Fri, 11 Oct 2024 09:08:40 +0200 Subject: [PATCH] fix: do not display placeholder in full variant. Do not show error when image is missng, show placeholder. --- acf-fields/json/card.json | 4 ++-- acf-fields/php/card.php | 13 ++++++++----- source/php/Module/Card/views/card.blade.php | 3 ++- source/php/Module/Full/views/full.blade.php | 1 + 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/acf-fields/json/card.json b/acf-fields/json/card.json index 840fe2f..6694e86 100644 --- a/acf-fields/json/card.json +++ b/acf-fields/json/card.json @@ -8,7 +8,7 @@ "name": "image", "type": "focuspoint", "instructions": "", - "required": 1, + "required": 0, "conditional_logic": 0, "wrapper": { "width": "", @@ -272,4 +272,4 @@ "acfe_meta": "", "acfe_note": "" }] - \ No newline at end of file + diff --git a/acf-fields/php/card.php b/acf-fields/php/card.php index d67423a..480be3f 100644 --- a/acf-fields/php/card.php +++ b/acf-fields/php/card.php @@ -1,7 +1,9 @@ 'group_63ff1e1238bd3', 'title' => __('Card Section Settings', 'modularity-sections'), 'fields' => array( @@ -11,7 +13,7 @@ 'name' => 'image', 'type' => 'focuspoint', 'instructions' => '', - 'required' => 1, + 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array( 'width' => '', @@ -275,4 +277,5 @@ 'acfe_meta' => '', 'acfe_note' => '', )); - } \ No newline at end of file + +} \ No newline at end of file diff --git a/source/php/Module/Card/views/card.blade.php b/source/php/Module/Card/views/card.blade.php index 1581486..8933301 100644 --- a/source/php/Module/Card/views/card.blade.php +++ b/source/php/Module/Card/views/card.blade.php @@ -11,7 +11,8 @@ 'paddingBottom' => $spacing_bottom, 'stretch' => !is_admin() && isset($blockData) ? (bool) $blockData['align'] == 'full' : $stretch, 'context' => ['sectionsCard', 'sections', 'sections.card', 'module.sections.card'], - 'buttons' => !empty($buttons) ? $buttons : [] + 'buttons' => !empty($buttons) ? $buttons : [], + 'hasPlaceholder' => true, ]) @if (!empty($submodules) && is_array($submodules)) {!! $submoduleRendered !!} diff --git a/source/php/Module/Full/views/full.blade.php b/source/php/Module/Full/views/full.blade.php index 15f5064..13e26cb 100644 --- a/source/php/Module/Full/views/full.blade.php +++ b/source/php/Module/Full/views/full.blade.php @@ -12,6 +12,7 @@ 'paddingTop' => $spacing_top, 'paddingBottom' => $spacing_bottom, 'stretch' => !is_admin() && isset($blockData) ? (bool) $blockData['align'] == 'full' : $stretch, + 'hasPlaceholder' => false, 'context' => ['sectionsFull', 'sections', 'sections.full', 'module.sections.full'] ]) @if (!empty($submodules) && is_array($submodules))