Skip to content

Commit

Permalink
Better ACF field group structure and use ACF interface to manage taxo…
Browse files Browse the repository at this point in the history
…nomy
  • Loading branch information
michaelclaesson committed Nov 7, 2024
1 parent 758aa9c commit 5cfbe8c
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 152 deletions.
12 changes: 12 additions & 0 deletions modularity-noticeboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,17 @@
// Start application
$modularityNoticeboardApp = new ModularityNoticeboard\App();

// Acf auto import and export
add_action('acf/init', function () {
$acfExportManager = new \AcfExportManager\AcfExportManager();
$acfExportManager->setTextdomain('modularity-noticeboard');
$acfExportManager->setExportFolder(MODULARITYNOTICEBOARD_PATH . 'source/php/AcfFields/');
$acfExportManager->autoExport(array(
'module' => 'group_57da9a06e21a8',
'post-type' => 'group_57db7edf10454',
));
$acfExportManager->import();
});

register_activation_hook(__FILE__, array($modularityNoticeboardApp, 'install'));
register_deactivation_hook(__FILE__, array($modularityNoticeboardApp, 'uninstall'));
78 changes: 0 additions & 78 deletions source/acf-json/modularity-announcement-fields.json

This file was deleted.

64 changes: 0 additions & 64 deletions source/acf-json/modularity-noticeboard-fields.json

This file was deleted.

83 changes: 83 additions & 0 deletions source/php/AcfFields/json/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[{
"key": "group_57da9a06e21a8",
"title": "Noticeboard",
"fields": [
{
"key": "field_57db72b205060",
"label": "Introductory text",
"name": "introductory_text",
"aria-label": "",
"type": "wysiwyg",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"tabs": "all",
"toolbar": "full",
"media_upload": 0,
"delay": 0
},
{
"key": "field_57da9ced957d4",
"label": "Filter by term",
"name": "filter_posts_by_tag",
"aria-label": "",
"type": "taxonomy",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "announcement_type",
"field_type": "radio",
"allow_null": 0,
"add_term": 1,
"save_terms": 0,
"load_terms": 0,
"return_format": "id",
"multiple": 0,
"bidirectional_target": []
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "mod-noticeboard"
}
],
[
{
"param": "block",
"operator": "==",
"value": "acf\/noticeboard"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"acfe_display_title": "",
"acfe_autosync": [
"json"
],
"acfe_form": 0,
"acfe_meta": "",
"acfe_note": ""
}]

95 changes: 95 additions & 0 deletions source/php/AcfFields/json/post-type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[{
"key": "group_57db7edf10454",
"title": "Announcement",
"fields": [
{
"key": "field_57db7f09b2a53",
"label": "Link",
"name": "link",
"aria-label": "",
"type": "url",
"instructions": "Link to a file",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": ""
},
{
"key": "field_57db7f7cb2a54",
"label": "Meeting date",
"name": "meeting_date",
"aria-label": "",
"type": "date_picker",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"display_format": "d\/m\/Y",
"return_format": "d\/m\/Y",
"first_day": 1
},
{
"key": "field_58bfb86c760e3",
"label": "Announcement type",
"name": "announcement_type",
"aria-label": "",
"type": "taxonomy",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "announcement_type",
"add_term": 1,
"save_terms": 1,
"load_terms": 1,
"return_format": "id",
"field_type": "radio",
"allow_null": 0,
"acfe_bidirectional": {
"acfe_bidirectional_enabled": "0"
},
"bidirectional": 0,
"multiple": 0,
"bidirectional_target": []
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "announcement"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"acfe_display_title": "",
"acfe_autosync": [
"json"
],
"acfe_form": 0,
"acfe_meta": "",
"acfe_note": ""
}]

Loading

0 comments on commit 5cfbe8c

Please sign in to comment.