wysiwyg block
This commit is contained in:
@@ -33,12 +33,6 @@ class Dynamic
|
||||
$field['choices'][$slug] = '<i class="fas fa-circle" style="color: '. $hex .'"></i> ' . @$NameThatColour->name($hex)['name'];
|
||||
endforeach;
|
||||
|
||||
$field['choices']['quaternary-white'] = '<i class="fas fa-circle text-gradient text-gradient-quaternary-white"></i> ' . @$NameThatColour->name($colour->name2hex('quaternary'))['name'] . ' to White';
|
||||
$field['choices']['quinary-white'] = '<i class="fas fa-circle text-gradient text-gradient-quinary-white"></i> ' . @$NameThatColour->name($colour->name2hex('quinary'))['name'] . ' to White';
|
||||
|
||||
$field['choices']['white-quaternary'] = '<i class="fas fa-circle text-gradient text-gradient-white-quaternary"></i> White to ' . @$NameThatColour->name($colour->name2hex('quaternary'))['name'];
|
||||
$field['choices']['white-quinary'] = '<i class="fas fa-circle text-gradient text-gradient-white-quinary"></i> White to ' . @$NameThatColour->name($colour->name2hex('quinary'))['name'];
|
||||
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\PostTypes;
|
||||
|
||||
class Driver
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_action('init', [$this, 'register']);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$td = 'sage';
|
||||
$postType = 'driver';
|
||||
|
||||
register_extended_post_type(
|
||||
$postType,
|
||||
[
|
||||
'labels' => [
|
||||
'featured_image' => __('Portrait', $td),
|
||||
],
|
||||
'menu_position' => 40,
|
||||
'supports' => [
|
||||
'title',
|
||||
'excerpt',
|
||||
'thumbnail',
|
||||
'page-attributes',
|
||||
],
|
||||
'menu_icon' => 'dashicons-car',
|
||||
'rewrite' => false,
|
||||
'has_archive' => false,
|
||||
'publicly_queryable' => false,
|
||||
'exclude_from_search' => true,
|
||||
'capability_type' => 'page',
|
||||
'show_in_nav_menus' => false,
|
||||
'admin_cols' => [
|
||||
'credentials' =>[
|
||||
'title' => __('Credentials', $td),
|
||||
'meta_key' => 'badegg_driver_credentials',
|
||||
],
|
||||
'driver_category' => [
|
||||
'title' => __('Category', $td),
|
||||
'taxonomy' => 'driver_category',
|
||||
],
|
||||
'portrait' => [
|
||||
'title' => __('Portrait', $td),
|
||||
'featured_image' => 'thumbnail',
|
||||
'width' => 48,
|
||||
// 'height' => 48,
|
||||
],
|
||||
],
|
||||
],
|
||||
);
|
||||
|
||||
register_extended_taxonomy(
|
||||
'driver_category',
|
||||
$postType,
|
||||
[
|
||||
// 'meta_box' => 'radio',
|
||||
'rewrite' => false,
|
||||
'publicly_queryable' => false,
|
||||
'show_in_nav_menus' => false,
|
||||
],
|
||||
[
|
||||
'singular' => __('Category', $td),
|
||||
'plural' => __('Categories', $td),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,8 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"App\\": "app/",
|
||||
"Blocks\\": "resources/views/blocks"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
|
||||
@@ -59,11 +59,7 @@ function autoload_psr4($name) {
|
||||
}
|
||||
|
||||
function autoload_psr4_blocks() {
|
||||
$blockDir = __dir__ . '/resources/views/blocks';
|
||||
|
||||
if(!is_dir($blockDir)) return;
|
||||
|
||||
$path = $blockDir . '/*';
|
||||
$path = __dir__ . '/resources/views/blocks/*';
|
||||
$namespace = 'Blocks\\';
|
||||
|
||||
foreach(glob($path, GLOB_ONLYDIR) as $directory) {
|
||||
|
||||
156
web/app/themes/badegg/resources/acf/group_block_wysiwyg.json
Normal file
156
web/app/themes/badegg/resources/acf/group_block_wysiwyg.json
Normal file
@@ -0,0 +1,156 @@
|
||||
{
|
||||
"key": "group_block_wysiwyg",
|
||||
"title": "Block: WYSIWYG",
|
||||
"fields": [
|
||||
{
|
||||
"key": "field_68334c31c5faf",
|
||||
"label": "Introduction",
|
||||
"name": "introduction",
|
||||
"aria-label": "",
|
||||
"type": "clone",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"clone": [
|
||||
"group_clone_block_intro"
|
||||
],
|
||||
"display": "seamless",
|
||||
"layout": "block",
|
||||
"prefix_label": 0,
|
||||
"prefix_name": 0
|
||||
},
|
||||
{
|
||||
"key": "field_68334c31c63fc",
|
||||
"label": "Content",
|
||||
"name": "",
|
||||
"aria-label": "",
|
||||
"type": "accordion",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"open": 1,
|
||||
"multi_expand": 0,
|
||||
"endpoint": 0
|
||||
},
|
||||
{
|
||||
"key": "field_68334c31c6fab",
|
||||
"label": "",
|
||||
"name": "wysiwyg",
|
||||
"aria-label": "",
|
||||
"type": "wysiwyg",
|
||||
"instructions": "All drivers will be displayed if no category is selected.",
|
||||
"required": 0,
|
||||
"conditional_logic": [
|
||||
[
|
||||
{
|
||||
"field": "field_68334c31c67cb",
|
||||
"operator": "==",
|
||||
"value": "local"
|
||||
}
|
||||
]
|
||||
],
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"default_value": "",
|
||||
"allow_in_bindings": 0,
|
||||
"tabs": "all",
|
||||
"toolbar": "basic",
|
||||
"media_upload": 0,
|
||||
"delay": 0
|
||||
},
|
||||
{
|
||||
"key": "field_68334c31c738b",
|
||||
"label": "Content",
|
||||
"name": "",
|
||||
"aria-label": "",
|
||||
"type": "accordion",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"open": 0,
|
||||
"multi_expand": 0,
|
||||
"endpoint": 1
|
||||
},
|
||||
{
|
||||
"key": "field_68334c31c7775",
|
||||
"label": "Footer",
|
||||
"name": "footer",
|
||||
"aria-label": "",
|
||||
"type": "clone",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"clone": [
|
||||
"group_clone_block_footer"
|
||||
],
|
||||
"display": "seamless",
|
||||
"layout": "block",
|
||||
"prefix_label": 0,
|
||||
"prefix_name": 0
|
||||
},
|
||||
{
|
||||
"key": "field_68334c31c7b66",
|
||||
"label": "Settings",
|
||||
"name": "settings",
|
||||
"aria-label": "",
|
||||
"type": "clone",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"clone": [
|
||||
"group_clone_block_settings"
|
||||
],
|
||||
"display": "seamless",
|
||||
"layout": "block",
|
||||
"prefix_label": 0,
|
||||
"prefix_name": 0
|
||||
}
|
||||
],
|
||||
"location": [
|
||||
[
|
||||
{
|
||||
"param": "block",
|
||||
"operator": "==",
|
||||
"value": "acf\/badegg-wysiwyg"
|
||||
}
|
||||
]
|
||||
],
|
||||
"menu_order": 0,
|
||||
"position": "normal",
|
||||
"style": "default",
|
||||
"label_placement": "top",
|
||||
"instruction_placement": "label",
|
||||
"hide_on_screen": "",
|
||||
"active": true,
|
||||
"description": "",
|
||||
"show_in_rest": 0,
|
||||
"modified": 1748193022
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"key": "group_clone_background_settings",
|
||||
"title": "Clone: Background Settings",
|
||||
"fields": [
|
||||
{
|
||||
"key": "field_67325dd23234e",
|
||||
"label": "Background Colour",
|
||||
"name": "bg_colour",
|
||||
"aria-label": "",
|
||||
"type": "select",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "50",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"choices": {
|
||||
"primary": "<i class=\"fas fa-circle\" style=\"color: #002448\"><\/i> Prussian Blue",
|
||||
"secondary": "<i class=\"fas fa-circle\" style=\"color: #fc533e\"><\/i> Sunset Orange",
|
||||
"tertiary": "<i class=\"fas fa-circle\" style=\"color: #fdd400\"><\/i> Gold",
|
||||
"quaternary": "<i class=\"fas fa-circle\" style=\"color: #7d89d1\"><\/i> Moody Blue",
|
||||
"quinary": "<i class=\"fas fa-circle\" style=\"color: #ffdab4\"><\/i> Frangipani",
|
||||
"0": "<i class=\"fas fa-circle\" style=\"color: #FFFFFF\"><\/i> White",
|
||||
"black": "<i class=\"fas fa-circle\" style=\"color: #000000\"><\/i> Black",
|
||||
"quaternary-white": "<i class=\"fas fa-circle text-gradient text-gradient-quaternary-white\"><\/i> Moody Blue to White",
|
||||
"quinary-white": "<i class=\"fas fa-circle text-gradient text-gradient-quinary-white\"><\/i> Frangipani to White",
|
||||
"white-quaternary": "<i class=\"fas fa-circle text-gradient text-gradient-white-quaternary\"><\/i> White to Moody Blue",
|
||||
"white-quinary": "<i class=\"fas fa-circle text-gradient text-gradient-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": "",
|
||||
"create_options": 0,
|
||||
"save_options": 0
|
||||
},
|
||||
{
|
||||
"key": "field_67325e213234f",
|
||||
"label": "Background Tint",
|
||||
"name": "bg_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,
|
||||
"allow_in_bindings": 1,
|
||||
"ui": 1,
|
||||
"ajax": 0,
|
||||
"placeholder": "",
|
||||
"create_options": 0,
|
||||
"save_options": 0
|
||||
},
|
||||
{
|
||||
"key": "field_67350f526abf1",
|
||||
"label": "Text Contrast",
|
||||
"name": "contrast",
|
||||
"aria-label": "",
|
||||
"type": "select",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"choices": {
|
||||
"0": "Auto",
|
||||
"dark": "Force dark text",
|
||||
"light": "Force light text"
|
||||
},
|
||||
"default_value": 0,
|
||||
"return_format": "value",
|
||||
"multiple": 0,
|
||||
"allow_null": 0,
|
||||
"ui": 0,
|
||||
"ajax": 0,
|
||||
"placeholder": "",
|
||||
"create_options": 0,
|
||||
"save_options": 0
|
||||
}
|
||||
],
|
||||
"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": 1748194684
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
{
|
||||
"key": "group_clone_block_footer",
|
||||
"title": "Clone: Block Footer",
|
||||
"fields": [
|
||||
{
|
||||
"key": "field_67659b49a6db2",
|
||||
"label": "Footer",
|
||||
"name": "",
|
||||
"aria-label": "",
|
||||
"type": "accordion",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"open": 0,
|
||||
"multi_expand": 0,
|
||||
"endpoint": 0
|
||||
},
|
||||
{
|
||||
"key": "field_67659b49a754a",
|
||||
"label": "Blurb",
|
||||
"name": "blurb_footer",
|
||||
"aria-label": "",
|
||||
"type": "textarea",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"default_value": "",
|
||||
"maxlength": "",
|
||||
"rows": 3,
|
||||
"placeholder": "",
|
||||
"new_lines": ""
|
||||
},
|
||||
{
|
||||
"key": "field_67659b7502137",
|
||||
"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": 2,
|
||||
"collapsed": "",
|
||||
"button_label": "Add Button",
|
||||
"rows_per_page": 20,
|
||||
"sub_fields": [
|
||||
{
|
||||
"key": "field_67659b8702138",
|
||||
"label": "Button",
|
||||
"name": "button",
|
||||
"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_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": [
|
||||
[
|
||||
{
|
||||
"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": 1747958307
|
||||
}
|
||||
153
web/app/themes/badegg/resources/acf/group_clone_block_intro.json
Normal file
153
web/app/themes/badegg/resources/acf/group_clone_block_intro.json
Normal file
@@ -0,0 +1,153 @@
|
||||
{
|
||||
"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_682fb8d9f6f3f",
|
||||
"label": "Overline",
|
||||
"name": "overline",
|
||||
"aria-label": "",
|
||||
"type": "text",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"default_value": "",
|
||||
"maxlength": "",
|
||||
"allow_in_bindings": 0,
|
||||
"placeholder": "",
|
||||
"prepend": "",
|
||||
"append": ""
|
||||
},
|
||||
{
|
||||
"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": "br"
|
||||
},
|
||||
{
|
||||
"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_682fb9add5a3b",
|
||||
"label": "Alignment",
|
||||
"name": "intro_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_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": 1747958910
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
@extends('layouts.block', [
|
||||
'block' => $block,
|
||||
'data' => $data,
|
||||
])
|
||||
|
||||
@section('block-content')
|
||||
@if(@$data['wysiwyg'])
|
||||
<div class="main-wysiwyg wysiwyg">
|
||||
{!! @$data['wysiwyg'] !!}
|
||||
</div>
|
||||
@endif
|
||||
@overwrite
|
||||
|
||||
BIN
web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.jpg
Normal file
BIN
web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Blocks\WYSIWYG;
|
||||
use App\Utilities;
|
||||
use App\ACF;
|
||||
|
||||
class WYSIWYG
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_action('acf/init', [$this, 'init']);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
acf_register_block_type([
|
||||
'name' => 'badegg/wysiwyg',
|
||||
'title' => __('Basic Content'),
|
||||
'description' => __('Basic text editor '),
|
||||
'render_callback' => [ $this, 'render'],
|
||||
'category' => 'badegg',
|
||||
'icon' => 'editor-paragraph',
|
||||
'supports' => [
|
||||
'align' => false,
|
||||
],
|
||||
'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 '<img style="display: block; width: 100%" src="' . $themeURL . '/resources/views/blocks/' . $name . '/' . $name . '.jpg" />';
|
||||
return;
|
||||
endif;
|
||||
|
||||
$CssClasses = new Utilities\CssClasses;
|
||||
$Colour = new Utilities\Colour;
|
||||
$CloneGroup = new ACF\CloneGroup;
|
||||
|
||||
$data = [];
|
||||
|
||||
$fields = [
|
||||
'wysiwyg',
|
||||
];
|
||||
$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['block'] = $block;
|
||||
|
||||
echo \Roots\view("blocks.$name.$name", [
|
||||
'data' => $data,
|
||||
'block' => $block,
|
||||
])->render();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.section-badegg-wysiwyg {
|
||||
container-name: WYSIWYG;
|
||||
container-type: inline-size;
|
||||
|
||||
.main-wysiwyg {
|
||||
@container WYSIWYG (min-width: #{$screen-lg}) {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
}
|
||||
|
||||
.section-intro { padding-bottom: $sectionSmall; }
|
||||
.section-footer { padding-top: $sectionSmall; }
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
@if(@$data['section_anchor_id'])
|
||||
<div id="{{ $data['section_anchor_id'] }}" class="section-anchor"></div>
|
||||
@endif
|
||||
|
||||
<section
|
||||
id="{{ $block['id'] }}"
|
||||
class="badegg-block
|
||||
@if(@$data['section_classes']) {{ implode(' ', $data['section_classes']) }} @endif
|
||||
{{ @$block['className'] }}
|
||||
">
|
||||
|
||||
<div class="section-{{ $block['name'] }}-inner">
|
||||
@if(@$data['heading'] || @$data['blurb'])
|
||||
<div class="section-intro section-medium section-zero-top container container-large bg-watermarked-content {{ @$data['knockout'] }} align-{{ @$data['intro_alignment'] ?: 'centre' }} ">
|
||||
<div class="section-intro-inner wysiwyg">
|
||||
@if(@$data['overline']) <p class="overline secondary"><strong>{{ $data['overline'] }}</strong></p> @endif
|
||||
<h2 class="section-title">{{ @$data['heading'] }}</h2>
|
||||
<p>{{ @$data['blurb'] }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="container container-{{ @$data['container_width'] ?: 'large' }} block-content bg-watermarked-content">
|
||||
@yield('block-content')
|
||||
</div>
|
||||
|
||||
@if(@$data['links'] || @$data['blurb_footer'])
|
||||
<div class="section-footer section-medium section-zero-bottom container container-narrow align-{{ @$data['footer_alignment'] ?: 'centre' }} wysiwyg bg-watermarked-content {{ @$data['knockout'] }}">
|
||||
|
||||
<p>{{ @$data['blurb_footer'] }}</p>
|
||||
|
||||
@if(@$data['links'])
|
||||
<div class="btn-wrap">
|
||||
@foreach($data['links'] as $link)
|
||||
@include('components.button', $link)
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(@$data['bg_image'])
|
||||
<div class="bg-watermarked-image" style="opacity: {!! (@$data['bg_opacity'] ?: 30) * 0.01 !!}">
|
||||
{!! $ImageSrcset->render([
|
||||
'image' => $data['bg_image'],
|
||||
'name' => 'hero',
|
||||
'lazy' => true,
|
||||
]) !!}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if(@$data['angle_status'])
|
||||
@if(@$data['angle_position'] == 'both')
|
||||
@foreach(['top', 'bottom'] as $position)
|
||||
@include('partials.angle', [
|
||||
'position' => $position,
|
||||
'direction' => @$data['angle_direction'],
|
||||
'tint' => @$data['angle_tint'],
|
||||
'colour' => @$data['angle_colour'] ?: 'white',
|
||||
])
|
||||
@endforeach
|
||||
@else
|
||||
@include('partials.angle', [
|
||||
'position' => @$data['angle_position'],
|
||||
'direction' => @$data['angle_direction'],
|
||||
'tint' => @$data['angle_tint'],
|
||||
'colour' => @$data['angle_colour'] ?: 'white',
|
||||
])
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</section>
|
||||
Reference in New Issue
Block a user