acf blocks: adjust padding and contrast controls

This commit is contained in:
2026-01-04 17:55:34 +00:00
parent feec3dcbda
commit fa82ec6446
3 changed files with 79 additions and 73 deletions

View File

@@ -30,17 +30,17 @@ class CssClasses {
'tint' => $props['bg_tint'],
]);
if(($knockout && $Colour->is_dark($hex) || $props['contrast'] == 'light'))
if(($props['contrast'] && $knockout))
$classes[] = 'knockout';
if($props['padding_top'])
if(!$props['padding_top'])
$classes[] = 'section-zero-top';
if($props['padding_bottom'])
if(!$props['padding_bottom'])
$classes[] = 'section-zero-bottom';
if($props['bg_image'])
$classes[] = "bg-watermarked";
$classes[] = "has-bg-image";
return $classes;
}
@@ -89,7 +89,7 @@ class CssClasses {
if($args['align'])
$classes[] = 'align-' . $args['align'];
if(($Colour->is_dark($hex) || $bg_props['contrast'] == 'light'))
if(($bg_props['contrast']))
$classes[] = 'knockout';
return $classes;

View File

@@ -17,9 +17,12 @@
"id": ""
},
"choices": {
"0": "auto",
"0": "None",
"primary": "<i class=\"fas fa-circle\" style=\"color: #dd3333\"><\/i> Punch",
"secondary": "<i class=\"fas fa-circle\" style=\"color: #81d742\"><\/i> Atlantis",
"tertiary": "<i class=\"fas fa-circle\" style=\"color: #8224e3\"><\/i> Purple Heart",
"white": "<i class=\"fas fa-circle\" style=\"color: #FFFFFF\"><\/i> White",
"grey": "<i class=\"fas fa-circle\" style=\"color: #808080\"><\/i> Gray",
"black": "<i class=\"fas fa-circle\" style=\"color: #000000\"><\/i> Black"
},
"default_value": 0,
@@ -91,10 +94,10 @@
},
{
"key": "field_67350f526abf1",
"label": "Text Contrast",
"label": "",
"name": "contrast",
"aria-label": "",
"type": "select",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -103,20 +106,12 @@
"class": "",
"id": ""
},
"choices": {
"0": "Auto",
"dark": "Force dark text",
"light": "Force light text"
},
"message": "Text Contrast",
"default_value": 0,
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
"allow_in_bindings": 0,
"ui_on_text": "Light",
"ui_off_text": "Dark",
"ui": 1
}
],
"location": [
@@ -137,5 +132,6 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1765746167
"display_title": "",
"modified": 1767548180
}

View File

@@ -36,56 +36,6 @@
},
"layout": "block",
"sub_fields": [
{
"key": "field_67350eb62cdf9",
"label": "Top Padding",
"name": "padding_top",
"aria-label": "",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"choices": [
"On",
"Off"
],
"default_value": "",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
},
{
"key": "field_673510c1dc830",
"label": "Bottom Padding",
"name": "padding_bottom",
"aria-label": "",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"choices": [
"On",
"Off"
],
"default_value": "",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
},
{
"key": "field_6800097e61765",
"label": "Container Width",
@@ -119,6 +69,66 @@
"create_options": 0,
"save_options": 0
},
{
"key": "field_67350eb62cdf9",
"label": "",
"name": "padding_top",
"aria-label": "",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "Top Padding",
"default_value": 1,
"allow_in_bindings": 0,
"ui_on_text": "On",
"ui_off_text": "Off",
"ui": 1
},
{
"key": "field_673510c1dc830",
"label": "",
"name": "padding_bottom",
"aria-label": "",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "Bottom Padding",
"default_value": 1,
"allow_in_bindings": 0,
"ui_on_text": "On",
"ui_off_text": "Off",
"ui": 1
},
{
"key": "field_695aa550e16d4",
"label": "Background",
"name": "",
"aria-label": "",
"type": "message",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "",
"new_lines": "wpautop",
"esc_html": 0
},
{
"key": "field_67350aeb146ca",
"label": "Background",
@@ -181,5 +191,5 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"modified": 1765815052
"modified": 1767548583
}