diff --git a/app/ACF/CloneGroup.php b/app/ACF/CloneGroup.php index 04052f0..ace0bcb 100644 --- a/app/ACF/CloneGroup.php +++ b/app/ACF/CloneGroup.php @@ -8,21 +8,51 @@ class CloneGroup { } - public function background() + public function block_background() { return [ 'contrast', - 'bg_type', 'bg_colour', 'bg_tint', - 'bg_opacity', - 'bg_image', - 'bg_video', - 'pattern', - 'pattern_top', - 'pattern_bottom', - 'padding_top', - 'padding_bottom', ]; } + + public function block_intro() + { + return [ + 'overline', + 'heading', + 'blurb', + 'intro_alignment', + ]; + } + + public function block_footer() + { + return [ + 'blurb_footer', + 'links', + 'footer_alignment', + ]; + } + + public function block_settings() + { + return [ + 'section_anchor_id', + 'padding_top', + 'padding_bottom', + 'container_width', + 'angle_status', + 'angle_position', + 'angle_direction', + 'angle_colour', + 'angle_tint', + ]; + } + + public function block_all() + { + return array_merge($this->block_intro(), $this->block_footer(), $this->block_settings(), $this->block_background()); + } } diff --git a/app/Admin/Blocks.php b/app/Admin/Blocks.php index 5825412..2917dc8 100644 --- a/app/Admin/Blocks.php +++ b/app/Admin/Blocks.php @@ -1,14 +1,30 @@ 'badegg', + 'title' => __('Provided by Bad Egg Digital'), + ], + ], $categories); + + return $categories; + } + public function blacklist() { // Reference: @@ -130,6 +146,10 @@ class Blocks 'core/social-links', ]; + $Content = new Content\Content(); + + $blacklist = array_diff($blacklist, $Content->inner_blocks()); + return array_values( array_diff( $blocks, $blacklist ) ); } } diff --git a/app/Blocks/BadExample.php b/app/Blocks/BadExample.php deleted file mode 100644 index 5419f9c..0000000 --- a/app/Blocks/BadExample.php +++ /dev/null @@ -1,65 +0,0 @@ - 'badegg/bad-example', - 'title' => __('Bad Example'), - 'description' => __('This is an example block'), - 'render_callback' => [ $this, 'render'], - 'category' => 'layout', - 'multiple' => false, - 'icon' => [ - 'src' => 'dismiss', - ], - 'supports' => [ - 'align' => false, - ], - ]); - } - - public function render($block) - { - $CssClasses = new Utilities\CssClasses; - $Colour = new Utilities\Colour; - $CloneGroup = new ACF\CloneGroup; - - $data = []; - - $fields = [ - 'heading', - 'blurb', - ]; - - $fields = array_merge($fields, $CloneGroup->background()); - - foreach($fields as $field): - $data[$field] = get_field($field); - endforeach; - - unset($block['data']); - $block['name'] = str_replace('acf/', '', $block['name']); - - $data = array_merge($data, $block); - $data['section_classes'] = $CssClasses->section($data); - $data['block'] = $block; - - $data['knockout'] = ($Colour->is_dark($data['bg_colour'], $data['bg_tint'], $data['contrast'])) ? null : 'knockout'; - - echo \Roots\view('blocks.bad-example', [ - 'data' => $data, - 'block' => $block, - ])->render(); - } -} diff --git a/app/Utilities/CssClasses.php b/app/Utilities/CssClasses.php index 9f95405..04dd80f 100644 --- a/app/Utilities/CssClasses.php +++ b/app/Utilities/CssClasses.php @@ -14,7 +14,8 @@ class CssClasses { $classes = [ 'section', - 'section-' . str_replace('acf/', '', $props['name']), + 'section-' . $props['name'], + // 'section-' . str_replace('acf/', '', $props['name']), 'bg-' . $this->colourTint([ 'colour' => @$props['bg_colour'], 'tint' => @$props['bg_tint'], diff --git a/app/View/Composers/App.php b/app/View/Composers/App.php index 2934c77..d4ca3cd 100644 --- a/app/View/Composers/App.php +++ b/app/View/Composers/App.php @@ -31,9 +31,6 @@ class App extends Composer 'VideoSrcset' => new Utilities\VideoSrcset, 'ImageSrcset' => new Utilities\ImageSrcset, 'siteName' => $this->siteName(), - 'company_legal' => get_field('badegg_company_legal', 'option'), - 'company_tel' => get_field('badegg_company_tel', 'option'), - 'company_email' => get_field('badegg_company_email', 'option'), ]; } } diff --git a/composer.json b/composer.json index 10f0436..97c8917 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,8 @@ }, "autoload": { "psr-4": { - "App\\": "app/" + "App\\": "app/", + "Blocks\\": "resources/views/blocks" } }, "require": { diff --git a/functions.php b/functions.php index 53061a4..d5eb088 100644 --- a/functions.php +++ b/functions.php @@ -57,9 +57,22 @@ autoload_psr4('PostTypes'); autoload_psr4('ACF'); autoload_psr4('Utilities'); autoload_psr4('Admin'); -autoload_psr4('Blocks'); autoload_psr4('Ajax'); +function autoload_psr4_blocks() { + $path = __dir__ . '/resources/views/blocks/*'; + $namespace = 'Blocks\\'; + + foreach(glob($path, GLOB_ONLYDIR) as $directory) { + $name = basename($directory); + $class = $namespace . $name . '\\' . $name; + + new $class(); + } +} + +autoload_psr4_blocks(); + /* |-------------------------------------------------------------------------- | Register Sage Theme Files diff --git a/resources/acf/group_block_bad_example.json b/resources/acf/group_block_content.json similarity index 68% rename from resources/acf/group_block_bad_example.json rename to resources/acf/group_block_content.json index 46929d9..9ee60fc 100644 --- a/resources/acf/group_block_bad_example.json +++ b/resources/acf/group_block_content.json @@ -1,9 +1,9 @@ { - "key": "group_block_bad_example", - "title": "Block: Bad Example", + "key": "group_block_content", + "title": "Block: Content", "fields": [ { - "key": "field_676599038e31d", + "key": "field_67659ad8dc795", "label": "", "name": "", "aria-label": "", @@ -16,42 +16,7 @@ "class": "", "id": "" }, - "message": "

<\/span> Bad Example<\/h3>", - "new_lines": "wpautop", - "esc_html": 0 - }, - { - "key": "field_67659accdc794", - "label": "Content", - "name": "", - "aria-label": "", - "type": "tab", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "placement": "top", - "endpoint": 0 - }, - { - "key": "field_67659ad8dc795", - "label": "Example", - "name": "", - "aria-label": "", - "type": "message", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "message": "Place your block-specific custom fields here.", + "message": "You can insert a variety of blocks inside of this one to build your page or post.", "new_lines": "wpautop", "esc_html": 0 }, @@ -127,7 +92,7 @@ { "param": "block", "operator": "==", - "value": "acf\/badegg-bad-example" + "value": "acf\/badegg-content" } ] ], @@ -140,5 +105,5 @@ "active": true, "description": "", "show_in_rest": 0, - "modified": 1734712286 + "modified": 1763915024 } diff --git a/resources/acf/group_block_intro.json b/resources/acf/group_block_intro.json deleted file mode 100644 index 8c5494b..0000000 --- a/resources/acf/group_block_intro.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "key": "group_block_intro", - "title": "Clone: Block Intro", - "fields": [ - { - "key": "field_67659970db415", - "label": "Introduction", - "name": "", - "aria-label": "", - "type": "tab", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "placement": "top", - "endpoint": 0 - }, - { - "key": "field_676599964d3cc", - "label": "Heading", - "name": "heading", - "aria-label": "", - "type": "text", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "default_value": "", - "maxlength": "", - "placeholder": "", - "prepend": "", - "append": "" - }, - { - "key": "field_6765999d4d3cd", - "label": "Blurb", - "name": "blurb", - "aria-label": "", - "type": "textarea", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "default_value": "", - "maxlength": "", - "rows": 3, - "placeholder": "", - "new_lines": "" - } - ], - "location": [ - [ - { - "param": "widget", - "operator": "==", - "value": "rss" - } - ] - ], - "menu_order": 0, - "position": "normal", - "style": "default", - "label_placement": "top", - "instruction_placement": "label", - "hide_on_screen": "", - "active": true, - "description": "", - "show_in_rest": 0, - "modified": 1734711913 -} diff --git a/resources/acf/group_clone_background_settings.json b/resources/acf/group_clone_background_settings.json index c4474f7..7b63f06 100644 --- a/resources/acf/group_clone_background_settings.json +++ b/resources/acf/group_clone_background_settings.json @@ -2,33 +2,6 @@ "key": "group_clone_background_settings", "title": "Clone: Background Settings", "fields": [ - { - "key": "field_672d3ba78bc40", - "label": "Background Type", - "name": "bg_type", - "aria-label": "", - "type": "select", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "choices": { - "0": "Solid Colour", - "image": "Still Photo", - "video": "Looping Video" - }, - "default_value": 0, - "return_format": "value", - "multiple": 0, - "allow_null": 0, - "ui": 0, - "ajax": 0, - "placeholder": "" - }, { "key": "field_67325dd23234e", "label": "Background Colour", @@ -39,26 +12,33 @@ "required": 0, "conditional_logic": 0, "wrapper": { - "width": "20", + "width": "50", "class": "", "id": "" }, "choices": { - "primary": "<\/i> Kimberly", - "secondary": "<\/i> Trendy Pink", - "tertiary": "<\/i> Turkish Rose", - "quaternary": "<\/i> Waikawa Gray", - "quinary": "<\/i> Boston Blue", + "primary": "<\/i> Prussian Blue", + "secondary": "<\/i> Sunset Orange", + "tertiary": "<\/i> Gold", + "quaternary": "<\/i> Moody Blue", + "quinary": "<\/i> Frangipani", + "0": "<\/i> White", "black": "<\/i> Black", - "0": "<\/i> White" + "quaternary-white": "<\/i> Moody Blue to White", + "quinary-white": "<\/i> Frangipani to White", + "white-quaternary": "<\/i> White to Moody Blue", + "white-quinary": "<\/i> White to Frangipani" }, "default_value": 0, "return_format": "value", "multiple": 0, "allow_null": 0, + "allow_in_bindings": 1, "ui": 1, "ajax": 0, - "placeholder": "" + "placeholder": "", + "create_options": 0, + "save_options": 0 }, { "key": "field_67325e213234f", @@ -70,7 +50,7 @@ "required": 0, "conditional_logic": 0, "wrapper": { - "width": "20", + "width": "50", "class": "", "id": "" }, @@ -87,9 +67,12 @@ "return_format": "value", "multiple": 0, "allow_null": 0, + "allow_in_bindings": 1, "ui": 1, "ajax": 0, - "placeholder": "" + "placeholder": "", + "create_options": 0, + "save_options": 0 }, { "key": "field_67350f526abf1", @@ -101,7 +84,7 @@ "required": 0, "conditional_logic": 0, "wrapper": { - "width": "20", + "width": "", "class": "", "id": "" }, @@ -116,413 +99,9 @@ "allow_null": 0, "ui": 0, "ajax": 0, - "placeholder": "" - }, - { - "key": "field_67325e3432350", - "label": "Opacity", - "name": "bg_opacity", - "aria-label": "", - "type": "range", - "instructions": "", - "required": 0, - "conditional_logic": [ - [ - { - "field": "field_672d3ba78bc40", - "operator": "!=", - "value": "0" - } - ] - ], - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "default_value": 30, - "min": 5, - "max": 100, - "step": 5, - "prepend": "", - "append": "%" - }, - { - "key": "field_6734b234f9c47", - "label": "Pattern Edge", - "name": "pattern", - "aria-label": "", - "type": "select", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "choices": { - "0": "Disabled", - "top": "Top", - "bottom": "Bottom", - "both": "Both" - }, - "default_value": 0, - "return_format": "value", - "multiple": 0, - "allow_null": 0, - "ui": 0, - "ajax": 0, - "placeholder": "" - }, - { - "key": "field_6734b2daf9c4b", - "label": "Top Pattern", - "name": "pattern_top", - "aria-label": "", - "type": "group", - "instructions": "", - "required": 0, - "conditional_logic": [ - [ - { - "field": "field_6734b234f9c47", - "operator": "==", - "value": "top" - } - ], - [ - { - "field": "field_6734b234f9c47", - "operator": "==", - "value": "both" - } - ] - ], - "wrapper": { - "width": "40", - "class": "", - "id": "" - }, - "layout": "block", - "sub_fields": [ - { - "key": "field_673514b45e977", - "label": "Colour", - "name": "colour", - "aria-label": "", - "type": "select", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "50", - "class": "", - "id": "" - }, - "choices": { - "primary": "<\/i> Kimberly", - "secondary": "<\/i> Trendy Pink", - "tertiary": "<\/i> Turkish Rose", - "quaternary": "<\/i> Waikawa Gray", - "quinary": "<\/i> Boston Blue", - "black": "<\/i> Black", - "0": "<\/i> White" - }, - "default_value": false, - "return_format": "", - "multiple": 0, - "allow_null": 0, - "ui": 1, - "ajax": 0, - "placeholder": "" - }, - { - "key": "field_673514d85e978", - "label": "Tint", - "name": "tint", - "aria-label": "", - "type": "select", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "50", - "class": "", - "id": "" - }, - "choices": { - "lightest": "Lightest", - "lighter": "Lighter", - "light": "Light", - "0": "None", - "dark": "Dark", - "darker": "Darker", - "darkest": "Darkest" - }, - "default_value": 0, - "return_format": "value", - "multiple": 0, - "allow_null": 0, - "ui": 0, - "ajax": 0, - "placeholder": "" - } - ] - }, - { - "key": "field_673514f15e979", - "label": "Bottom Pattern", - "name": "pattern_bottom", - "aria-label": "", - "type": "group", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "40", - "class": "", - "id": "" - }, - "layout": "block", - "sub_fields": [ - { - "key": "field_673514f15e97a", - "label": "Colour", - "name": "colour", - "aria-label": "", - "type": "select", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "50", - "class": "", - "id": "" - }, - "choices": { - "primary": "<\/i> Kimberly", - "secondary": "<\/i> Trendy Pink", - "tertiary": "<\/i> Turkish Rose", - "quaternary": "<\/i> Waikawa Gray", - "quinary": "<\/i> Boston Blue", - "black": "<\/i> Black", - "0": "<\/i> White" - }, - "default_value": false, - "return_format": "value", - "multiple": 0, - "allow_null": 0, - "ui": 1, - "ajax": 0, - "placeholder": "" - }, - { - "key": "field_673514f15e97b", - "label": "Tint", - "name": "tint", - "aria-label": "", - "type": "select", - "instructions": "", - "required": 0, - "conditional_logic": [ - [ - { - "field": "field_673514f15e97a", - "operator": "!=", - "value": "black" - } - ], - [ - { - "field": "field_673514f15e97a", - "operator": "!=", - "value": "0" - } - ] - ], - "wrapper": { - "width": "50", - "class": "", - "id": "" - }, - "choices": { - "lightest": "Lightest", - "lighter": "Lighter", - "light": "Light", - "0": "None", - "dark": "Dark", - "darker": "Darker", - "darkest": "Darkest" - }, - "default_value": 0, - "return_format": "value", - "multiple": 0, - "allow_null": 0, - "ui": 0, - "ajax": 0, - "placeholder": "" - } - ] - }, - { - "key": "field_672d3b128bc39", - "label": "Background Image", - "name": "bg_image", - "aria-label": "", - "type": "image", - "instructions": "", - "required": 0, - "conditional_logic": [ - [ - { - "field": "field_672d3ba78bc40", - "operator": "!=", - "value": "0" - } - ] - ], - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "return_format": "id", - "library": "all", - "min_width": "", - "min_height": "", - "min_size": "", - "max_width": "", - "max_height": "", - "max_size": "", - "mime_types": "", - "preview_size": "medium" - }, - { - "key": "field_672d3b228bc3a", - "label": "Background Video", - "name": "bg_video", - "aria-label": "", - "type": "group", - "instructions": "", - "required": 0, - "conditional_logic": [ - [ - { - "field": "field_672d3ba78bc40", - "operator": "==", - "value": "video" - } - ] - ], - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "layout": "block", - "sub_fields": [ - { - "key": "field_672d3b428bc3b", - "label": "Extra Small", - "name": "xs", - "aria-label": "", - "type": "file", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "return_format": "array", - "library": "all", - "min_size": "", - "max_size": "", - "mime_types": "mp4" - }, - { - "key": "field_672d3b678bc3c", - "label": "Small", - "name": "sm", - "aria-label": "", - "type": "file", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "return_format": "array", - "library": "all", - "min_size": "", - "max_size": "", - "mime_types": "mp4" - }, - { - "key": "field_672d3b728bc3d", - "label": "Medium", - "name": "md", - "aria-label": "", - "type": "file", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "return_format": "array", - "library": "all", - "min_size": "", - "max_size": "", - "mime_types": "mp4" - }, - { - "key": "field_672d3b7a8bc3e", - "label": "Large", - "name": "lg", - "aria-label": "", - "type": "file", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "return_format": "array", - "library": "all", - "min_size": "", - "max_size": "", - "mime_types": "mp4" - }, - { - "key": "field_672d3b838bc3f", - "label": "Extra Large", - "name": "xl", - "aria-label": "", - "type": "file", - "instructions": "", - "required": 0, - "conditional_logic": 0, - "wrapper": { - "width": "20", - "class": "", - "id": "" - }, - "return_format": "array", - "library": "all", - "min_size": "", - "max_size": "", - "mime_types": "mp4" - } - ] + "placeholder": "", + "create_options": 0, + "save_options": 0 } ], "location": [ @@ -543,5 +122,5 @@ "active": true, "description": "", "show_in_rest": 0, - "modified": 1733505903 + "modified": 1748194684 } diff --git a/resources/acf/group_block_footer.json b/resources/acf/group_clone_block_footer.json similarity index 65% rename from resources/acf/group_block_footer.json rename to resources/acf/group_clone_block_footer.json index 08e144c..aa0605d 100644 --- a/resources/acf/group_block_footer.json +++ b/resources/acf/group_clone_block_footer.json @@ -1,5 +1,5 @@ { - "key": "group_block_footer", + "key": "group_clone_block_footer", "title": "Clone: Block Footer", "fields": [ { @@ -7,7 +7,7 @@ "label": "Footer", "name": "", "aria-label": "", - "type": "tab", + "type": "accordion", "instructions": "", "required": 0, "conditional_logic": 0, @@ -16,7 +16,8 @@ "class": "", "id": "" }, - "placement": "top", + "open": 0, + "multi_expand": 0, "endpoint": 0 }, { @@ -53,7 +54,7 @@ "class": "", "id": "" }, - "layout": "table", + "layout": "block", "pagination": 0, "min": 0, "max": 2, @@ -85,6 +86,54 @@ "parent_repeater": "field_67659b7502137" } ] + }, + { + "key": "field_682fb9ff58080", + "label": "Alignment", + "name": "footer_alignment", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "centre": "Centre", + "left": "Left", + "right": "Right" + }, + "default_value": "centre", + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 0, + "ui": 0, + "ajax": 0, + "placeholder": "", + "create_options": 0, + "save_options": 0 + }, + { + "key": "field_6828dac95eb68", + "label": "Footer (end)", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 1 } ], "location": [ @@ -105,5 +154,5 @@ "active": true, "description": "", "show_in_rest": 0, - "modified": 1734712326 + "modified": 1747958307 } diff --git a/resources/acf/group_clone_block_intro.json b/resources/acf/group_clone_block_intro.json new file mode 100644 index 0000000..db466f5 --- /dev/null +++ b/resources/acf/group_clone_block_intro.json @@ -0,0 +1,149 @@ +{ + "key": "group_clone_block_intro", + "title": "Clone: Block Intro", + "fields": [ + { + "key": "field_67659970db415", + "label": "Introduction", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 0 + }, + { + "key": "field_676599964d3cc", + "label": "Heading", + "name": "heading", + "aria-label": "", + "type": "textarea", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "hfont", + "id": "" + }, + "default_value": "", + "maxlength": "", + "allow_in_bindings": 0, + "rows": 2, + "placeholder": "", + "new_lines": "" + }, + { + "key": "field_6765999d4d3cd", + "label": "Blurb", + "name": "blurb", + "aria-label": "", + "type": "textarea", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "maxlength": "", + "rows": 3, + "placeholder": "", + "new_lines": "" + }, + { + "key": "field_68bf1126c2760", + "label": "Links", + "name": "links", + "aria-label": "", + "type": "repeater", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "layout": "block", + "pagination": 0, + "min": 0, + "max": 1, + "collapsed": "", + "button_label": "Add Button", + "rows_per_page": 20, + "sub_fields": [ + { + "key": "field_68bf1171c2761", + "label": "Link", + "name": "link", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "clone": [ + "group_clone_button" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 0, + "prefix_name": 0, + "parent_repeater": "field_68bf1126c2760" + } + ] + }, + { + "key": "field_6828dae1d1bb0", + "label": "Intro (end)", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 1 + } + ], + "location": [ + [ + { + "param": "widget", + "operator": "==", + "value": "rss" + } + ] + ], + "menu_order": 0, + "position": "normal", + "style": "default", + "label_placement": "top", + "instruction_placement": "label", + "hide_on_screen": "", + "active": true, + "description": "", + "show_in_rest": 0, + "modified": 1757498726 +} diff --git a/resources/acf/group_clone_block_settings.json b/resources/acf/group_clone_block_settings.json index 49b97d2..e7b1868 100644 --- a/resources/acf/group_clone_block_settings.json +++ b/resources/acf/group_clone_block_settings.json @@ -7,7 +7,7 @@ "label": "Settings", "name": "", "aria-label": "", - "type": "tab", + "type": "accordion", "instructions": "", "required": 0, "conditional_logic": 0, @@ -16,9 +16,59 @@ "class": "", "id": "" }, - "placement": "top", + "open": 0, + "multi_expand": 0, "endpoint": 0 }, + { + "key": "field_680016e0fac24", + "label": "Anchor ID", + "name": "section_anchor_id", + "aria-label": "", + "type": "text", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "maxlength": "", + "placeholder": "", + "prepend": "#", + "append": "" + }, + { + "key": "field_6800097e61765", + "label": "Container Width", + "name": "container_width", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "0": "Full Width", + "large": "Large", + "medium": "Medium", + "small": "Small", + "narrow": "Narrow" + }, + "default_value": 0, + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "ui": 0, + "ajax": 0, + "placeholder": "" + }, { "key": "field_67350eb62cdf9", "label": "Top Padding", @@ -29,7 +79,7 @@ "required": 0, "conditional_logic": 0, "wrapper": { - "width": "33.33", + "width": "50", "class": "", "id": "" }, @@ -54,7 +104,7 @@ "required": 0, "conditional_logic": 0, "wrapper": { - "width": "33.33", + "width": "50", "class": "", "id": "" }, @@ -108,6 +158,46 @@ "layout": "block", "prefix_label": 0, "prefix_name": 0 + }, + { + "key": "field_67fff4d4ddbb7", + "label": "Angle", + "name": "angle", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "clone": [ + "group_clone_angle" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 1, + "prefix_name": 1 + }, + { + "key": "field_6828da67543fc", + "label": "Settings (end)", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 1 } ], "location": [ @@ -128,5 +218,5 @@ "active": true, "description": "", "show_in_rest": 0, - "modified": 1731536288 + "modified": 1747508044 } diff --git a/resources/acf/group_clone_button.json b/resources/acf/group_clone_button.json index a0e81b2..b1881dc 100644 --- a/resources/acf/group_clone_button.json +++ b/resources/acf/group_clone_button.json @@ -9,14 +9,15 @@ "aria-label": "", "type": "link", "instructions": "", - "required": 0, + "required": 1, "conditional_logic": 0, "wrapper": { - "width": "40", + "width": "", "class": "", "id": "" }, - "return_format": "array" + "return_format": "array", + "allow_in_bindings": 1 }, { "key": "field_673529a2a37a1", @@ -26,14 +27,22 @@ "type": "text", "instructions": "", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_672d3d7b2c273", + "operator": "!=empty" + } + ] + ], "wrapper": { - "width": "20", + "width": "", "class": "", "id": "" }, "default_value": "", "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", "append": "" @@ -46,28 +55,42 @@ "type": "select", "instructions": "", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_672d3d7b2c273", + "operator": "!=empty" + } + ] + ], "wrapper": { - "width": "20", + "width": "", "class": "", "id": "" }, "choices": { - "primary": "<\/i> Kimberly", - "secondary": "<\/i> Trendy Pink", - "tertiary": "<\/i> Turkish Rose", - "quaternary": "<\/i> Waikawa Gray", - "quinary": "<\/i> Boston Blue", + "primary": "<\/i> Prussian Blue", + "secondary": "<\/i> Sunset Orange", + "tertiary": "<\/i> Gold", + "quaternary": "<\/i> Moody Blue", + "quinary": "<\/i> Frangipani", + "0": "<\/i> White", "black": "<\/i> Black", - "0": "<\/i> White" + "quaternary-white": "<\/i> Moody Blue to White", + "quinary-white": "<\/i> Frangipani to White", + "white-quaternary": "<\/i> White to Moody Blue", + "white-quinary": "<\/i> White to Frangipani" }, - "default_value": 0, + "default_value": "primary", "return_format": "value", "multiple": 0, "allow_null": 0, + "allow_in_bindings": 1, "ui": 1, "ajax": 0, - "placeholder": "" + "placeholder": "", + "create_options": 0, + "save_options": 0 }, { "key": "field_672d3dc52c275", @@ -77,9 +100,16 @@ "type": "select", "instructions": "", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_672d3d7b2c273", + "operator": "!=empty" + } + ] + ], "wrapper": { - "width": "20", + "width": "", "class": "", "id": "" }, @@ -91,9 +121,12 @@ "return_format": "value", "multiple": 0, "allow_null": 0, + "allow_in_bindings": 1, "ui": 0, "ajax": 0, - "placeholder": "" + "placeholder": "", + "create_options": 0, + "save_options": 0 } ], "location": [ @@ -114,5 +147,5 @@ "active": true, "description": "", "show_in_rest": 0, - "modified": 1731537485 + "modified": 1748001311 } diff --git a/resources/views/blocks/Content/Content.blade.php b/resources/views/blocks/Content/Content.blade.php new file mode 100644 index 0000000..39d59d8 --- /dev/null +++ b/resources/views/blocks/Content/Content.blade.php @@ -0,0 +1,18 @@ +@if(@$data['section_anchor_id']) +
+@endif + +
+ +
+
+ +
+
+ +
diff --git a/resources/views/blocks/Content/Content.jpg b/resources/views/blocks/Content/Content.jpg new file mode 100644 index 0000000..cdc4236 Binary files /dev/null and b/resources/views/blocks/Content/Content.jpg differ diff --git a/resources/views/blocks/Content/Content.php b/resources/views/blocks/Content/Content.php new file mode 100644 index 0000000..07dd563 --- /dev/null +++ b/resources/views/blocks/Content/Content.php @@ -0,0 +1,111 @@ + 'badegg/content', + 'title' => __('Content'), + 'description' => __('Wordpress blocks inside a wrapper'), + 'render_callback' => [ $this, 'render'], + 'category' => 'badegg', + 'icon' => 'columns', + 'supports' => [ + 'align' => false, + 'jsx' => true, + ], + 'example' => [ + 'attributes' => [ + 'mode' => 'preview', + 'data' => [ + 'inserter' => true, + ], + ], + ], + ]); + } + + public function render($block, $content = '', $is_preview = false) + { + $name = basename(__FILE__, '.php'); + $themeURL = get_template_directory_uri(); + + if($is_preview && @$block['data']['inserter']): + echo ''; + return; + endif; + + $CssClasses = new Utilities\CssClasses; + $Colour = new Utilities\Colour; + $CloneGroup = new ACF\CloneGroup; + + $data = []; + + $fields = [ + + ]; + + $fields = array_merge($fields, $CloneGroup->block_all()); + + foreach($fields as $field): + $data[$field] = get_field($field); + endforeach; + + unset($block['data']); + $block['name'] = str_replace('acf/', '', $block['name']); + + $data = array_merge($data, $block); + $data['section_classes'] = $CssClasses->section($data); + $data['allowed_blocks'] = $this->inner_blocks(); + $data['block'] = $block; + + echo \Roots\view("blocks.$name.$name", [ + 'data' => $data, + 'block' => $block, + ])->render(); + } + + public function inner_blocks() + { + return [ + // Design + 'core/separator', + 'core/spacer', + + // Media + 'core/cover', + 'core/file', + 'core/gallery', + 'core/image', + 'core/media-text', + 'core/audio', + 'core/video', + + // Text + 'core/footnotes', + 'core/heading', + 'core/list', + 'core/code', + 'core/details', + 'core/freeform', + 'core/list-item', + 'core/missing', + 'core/paragraph', + 'core/preformatted', + 'core/pullquote', + 'core/quote', + 'core/table', + 'core/verse', + ]; + } +} diff --git a/resources/views/blocks/bad-example.blade.php b/resources/views/blocks/Content/Content.scss similarity index 100% rename from resources/views/blocks/bad-example.blade.php rename to resources/views/blocks/Content/Content.scss diff --git a/resources/views/components/button.blade.php b/resources/views/components/button.blade.php new file mode 100644 index 0000000..39d7a30 --- /dev/null +++ b/resources/views/components/button.blade.php @@ -0,0 +1,5 @@ +@if(@$link) + + {{ @$link['title'] }} + +@endif diff --git a/resources/views/components/image.blade.php b/resources/views/components/image.blade.php index bcc84e5..cfc6b07 100644 --- a/resources/views/components/image.blade.php +++ b/resources/views/components/image.blade.php @@ -1,15 +1,18 @@ -@php($image = wp_get_attachment_image_src(@$id, 'medium')) +@php($image = wp_get_attachment_image_src(@$id, @$size)) -{{ get_post_meta( $id, '_wp_attachment_image_alt', true ) }} + alt="{{ get_post_meta( $id, '_wp_attachment_image_alt', true ) }}" + width="{{ $image[1] }}" + height="{{ $image[2] }}" + /> +@endif diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index f8c5572..e4dd306 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -17,19 +17,24 @@ {{ __('Skip to content', 'sage') }} - @include('sections.header') + @include('sections.header.header') -
- @yield('content') -
+
+
+ @yield('content') +
- @hasSection('sidebar') - - @endif + @hasSection('sidebar') + + @endif + + @include('sections.footer.footer') +
+ + @include('partials.menu-off-canvas') - @include('sections.footer') @php(do_action('get_footer')) diff --git a/resources/views/layouts/block.blade.php b/resources/views/layouts/block.blade.php index 48f7e62..5717c84 100644 --- a/resources/views/layouts/block.blade.php +++ b/resources/views/layouts/block.blade.php @@ -1,34 +1,50 @@ -
- @if(@$data['heading'] || @$data['blurb']) -
-

{{ @$data['heading'] }}

- @include('components.divider') -

{{ @$data['blurb'] }}

-
- @endif +@if(@$data['section_anchor_id']) +
+@endif + +
+ +
+ @if(@$data['heading'] || @$data['blurb']) +
+
+
+

{{ @$data['heading'] }}

+

{{ @$data['blurb'] }}

+
+ + @if(@$data['links']) +
+ @foreach($data['links'] as $link) + @include('components.button', $link) + @endforeach +
+ @endif +
+
+ @endif + +
+ @yield('block-content') +
+ + @if(@$data['links']) + + @endif -
- @yield('block-content')
- @if(@$data['links']) - - @endif - - @if(@$data['bg_image']) -
- {!! $ImageSrcset->render([ - 'image' => $data['bg_image'], - 'name' => 'hero', - 'lazy' => true, - ]) !!} -
- @endif -
diff --git a/resources/views/partials/menu-off-canvas.blade.php b/resources/views/partials/menu-off-canvas.blade.php new file mode 100644 index 0000000..b454d0f --- /dev/null +++ b/resources/views/partials/menu-off-canvas.blade.php @@ -0,0 +1,28 @@ + diff --git a/resources/views/sections/footer.blade.php b/resources/views/sections/footer/footer.blade.php similarity index 100% rename from resources/views/sections/footer.blade.php rename to resources/views/sections/footer/footer.blade.php diff --git a/resources/views/sections/footer/footer.scss b/resources/views/sections/footer/footer.scss new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/sections/header.blade.php b/resources/views/sections/header/header.blade.php similarity index 100% rename from resources/views/sections/header.blade.php rename to resources/views/sections/header/header.blade.php diff --git a/resources/views/sections/header/header.scss b/resources/views/sections/header/header.scss new file mode 100644 index 0000000..e69de29