Skip to content

Commit

Permalink
feat: Image select field (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin authored Oct 6, 2023
1 parent f615f04 commit a030352
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 55 deletions.
71 changes: 43 additions & 28 deletions source/php/AcfFields/json/mod-manual-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"key": "field_64ff23d0d91bf",
"label": "Display as",
"name": "display_as",
"type": "radio",
"type": "image_select",
"instructions": "",
"required": 1,
"conditional_logic": 0,
Expand All @@ -16,20 +16,35 @@
"id": ""
},
"choices": {
"list": "List",
"accordion": "Accordion",
"card": "Card",
"block": "Block",
"box": "Box",
"segment": "Segment",
"collection": "Collection"
},
"default_value": "card",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
"row-row-row-row-651d5ccf5ac81": {
"image-select-repeater-label": "Accordion",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/accordion.svg : accordion"
},
"row-row-row-row-651d5cdb5ac82": {
"image-select-repeater-label": "Block",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/block.svg : block"
},
"row-row-row-row-651d5cdf5ac83": {
"image-select-repeater-label": "Box",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/box.svg : box"
},
"row-row-row-row-651d5ce55ac84": {
"image-select-repeater-label": "Card",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/card.svg : card"
},
"row-row-row-row-651d5ceb5ac85": {
"image-select-repeater-label": "Collection",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/collection.svg : collection"
},
"row-row-row-row-651d5cf65ac86": {
"image-select-repeater-label": "List",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/list.svg : list"
},
"651ffdc788395": {
"image-select-repeater-label": "Segment",
"image-select-repeater-value": "https:\/\/dev.local.municipio.tech\/wp-content\/mu-plugins\/acf-image-select-field\/assets\/segment.svg : segment"
}
}
},
{
"key": "field_650067ed6cc3c",
Expand Down Expand Up @@ -122,12 +137,12 @@
{
"field": "field_64ff23d0d91bf",
"operator": "!=",
"value": "list"
"value": "accordion"
},
{
"field": "field_64ff23d0d91bf",
"operator": "!=",
"value": "accordion"
"value": "list"
}
]
],
Expand Down Expand Up @@ -246,10 +261,6 @@
"field": "field_64ff23d0d91bf",
"operator": "==",
"value": "accordion"
},
{
"field": "field_65005968bbc75",
"operator": "!=empty"
}
]
],
Expand Down Expand Up @@ -293,7 +304,7 @@
"key": "field_64ff231ed91b9",
"label": "Content",
"name": "content",
"type": "textarea",
"type": "wysiwyg",
"instructions": "",
"required": 0,
"conditional_logic": [
Expand All @@ -311,11 +322,10 @@
"id": ""
},
"default_value": "",
"acfe_textarea_code": 0,
"maxlength": "",
"rows": "",
"placeholder": "",
"new_lines": "",
"delay": 0,
"tabs": "all",
"toolbar": "full",
"media_upload": 1,
"parent_repeater": "field_64ff22b2d91b7"
},
{
Expand Down Expand Up @@ -393,9 +403,9 @@
},
"message": "",
"default_value": 1,
"ui": 0,
"ui_on_text": "",
"ui_off_text": "",
"ui": 0,
"parent_repeater": "field_64ff22b2d91b7"
},
{
Expand All @@ -411,6 +421,11 @@
"field": "field_64ff23d0d91bf",
"operator": "!=",
"value": "list"
},
{
"field": "field_64ff23d0d91bf",
"operator": "!=",
"value": "accordion"
}
]
],
Expand Down
69 changes: 42 additions & 27 deletions source/php/AcfFields/php/mod-manual-input.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'key' => 'field_64ff23d0d91bf',
'label' => __('Display as', 'modularity'),
'name' => 'display_as',
'type' => 'radio',
'type' => 'image_select',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
Expand All @@ -19,20 +19,35 @@
'id' => '',
),
'choices' => array(
'list' => __('List', 'modularity'),
'accordion' => __('Accordion', 'modularity'),
'card' => __('Card', 'modularity'),
'block' => __('Block', 'modularity'),
'box' => __('Box', 'modularity'),
'segment' => __('Segment', 'modularity'),
'collection' => __('Collection', 'modularity'),
'row-row-row-row-651d5ccf5ac81' => array(
'image-select-repeater-label' => 'Accordion',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/accordion.svg : accordion',
),
'row-row-row-row-651d5cdb5ac82' => array(
'image-select-repeater-label' => 'Block',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/block.svg : block',
),
'row-row-row-row-651d5cdf5ac83' => array(
'image-select-repeater-label' => 'Box',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/box.svg : box',
),
'row-row-row-row-651d5ce55ac84' => array(
'image-select-repeater-label' => 'Card',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/card.svg : card',
),
'row-row-row-row-651d5ceb5ac85' => array(
'image-select-repeater-label' => 'Collection',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/collection.svg : collection',
),
'row-row-row-row-651d5cf65ac86' => array(
'image-select-repeater-label' => 'List',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/list.svg : list',
),
'651ffdc788395' => array(
'image-select-repeater-label' => 'Segment',
'image-select-repeater-value' => 'https://dev.local.municipio.tech/wp-content/mu-plugins/acf-image-select-field/assets/segment.svg : segment',
),
),
'default_value' => __('card', 'modularity'),
'return_format' => 'value',
'allow_null' => 0,
'other_choice' => 0,
'layout' => 'horizontal',
'save_other_choice' => 0,
),
1 => array(
'key' => 'field_650067ed6cc3c',
Expand Down Expand Up @@ -125,12 +140,12 @@
0 => array(
'field' => 'field_64ff23d0d91bf',
'operator' => '!=',
'value' => 'list',
'value' => 'accordion',
),
1 => array(
'field' => 'field_64ff23d0d91bf',
'operator' => '!=',
'value' => 'accordion',
'value' => 'list',
),
),
),
Expand Down Expand Up @@ -250,10 +265,6 @@
'operator' => '==',
'value' => 'accordion',
),
1 => array(
'field' => 'field_65005968bbc75',
'operator' => '!=empty',
),
),
),
'wrapper' => array(
Expand Down Expand Up @@ -296,7 +307,7 @@
'key' => 'field_64ff231ed91b9',
'label' => __('Content', 'modularity'),
'name' => 'content',
'type' => 'textarea',
'type' => 'wysiwyg',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
Expand All @@ -314,11 +325,10 @@
'id' => '',
),
'default_value' => '',
'acfe_textarea_code' => 0,
'maxlength' => '',
'rows' => '',
'placeholder' => '',
'new_lines' => '',
'delay' => 0,
'tabs' => 'all',
'toolbar' => 'full',
'media_upload' => 1,
'parent_repeater' => 'field_64ff22b2d91b7',
),
3 => array(
Expand Down Expand Up @@ -396,9 +406,9 @@
),
'message' => '',
'default_value' => 1,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
'ui' => 0,
'parent_repeater' => 'field_64ff22b2d91b7',
),
6 => array(
Expand All @@ -415,6 +425,11 @@
'operator' => '!=',
'value' => 'list',
),
1 => array(
'field' => 'field_64ff23d0d91bf',
'operator' => '!=',
'value' => 'accordion',
),
),
),
'wrapper' => array(
Expand Down

0 comments on commit a030352

Please sign in to comment.