Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user group url select and fetch in basecontroller #1229

Merged
merged 9 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions library/AcfFields/json/user-group-url.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
[{
"key": "group_677e6a05e347c",
"title": "User Group Home Url",
"fields": [
{
"key": "field_677e6a08b2126",
"label": "Select type of link",
"name": "user_group_type_of_link",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"disabled": "Disabled",
"arbitrary_url": "Arbitrary URL",
"post_type": "Post Type",
"blog_id": "Network Site (multisite only)"
},
"default_value": "disabled",
"return_format": "value",
"multiple": 0,
"allow_custom": 0,
"search_placeholder": "",
"allow_null": 0,
"ui": 1,
"ajax": 0,
"placeholder": ""
},
{
"key": "field_677e6ad862963",
"label": "Arbitrary URL",
"name": "arbitrary_url",
"aria-label": "",
"type": "url",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_677e6a08b2126",
"operator": "==",
"value": "arbitrary_url"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": ""
},
{
"key": "field_677e6b1765fc5",
"label": "Post Type",
"name": "post_type",
"aria-label": "",
"type": "posttype_select",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_677e6a08b2126",
"operator": "==",
"value": "post_type"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"allow_null": 0,
"multiple": 0,
"placeholder": "",
"disabled": 0,
"readonly": 0
},
{
"key": "field_677e6b8534123",
"label": "Blog",
"name": "blog_id",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_677e6a08b2126",
"operator": "==",
"value": "blog_id"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {},
"default_value": false,
"return_format": "value",
"multiple": 0,
"allow_custom": 0,
"search_placeholder": "",
"allow_null": 0,
"ui": 1,
"ajax": 1,
"placeholder": ""
}
],
"location": [
[
{
"param": "taxonomy",
"operator": "==",
"value": "user_group"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "left",
"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": ""
}]

155 changes: 155 additions & 0 deletions library/AcfFields/php/user-group-url.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?php


if (function_exists('acf_add_local_field_group')) {

acf_add_local_field_group(array(
'key' => 'group_677e6a05e347c',
'title' => __('User Group Home Url', 'municipio'),
'fields' => array(
0 => array(
'key' => 'field_677e6a08b2126',
'label' => __('Select type of link', 'municipio'),
'name' => 'user_group_type_of_link',
'aria-label' => '',
'type' => 'select',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'disabled' => __('Disabled', 'municipio'),
'arbitrary_url' => __('Arbitrary URL', 'municipio'),
'post_type' => __('Post Type', 'municipio'),
'blog_id' => __('Network Site (multisite only)', 'municipio'),
),
'default_value' => __('disabled', 'municipio'),
'return_format' => 'value',
'multiple' => 0,
'allow_custom' => 0,
'search_placeholder' => '',
'allow_null' => 0,
'ui' => 1,
'ajax' => 0,
'placeholder' => '',
),
1 => array(
'key' => 'field_677e6ad862963',
'label' => __('Arbitrary URL', 'municipio'),
'name' => 'arbitrary_url',
'aria-label' => '',
'type' => 'url',
'instructions' => '',
'required' => 1,
'conditional_logic' => array(
0 => array(
0 => array(
'field' => 'field_677e6a08b2126',
'operator' => '==',
'value' => 'arbitrary_url',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
),
2 => array(
'key' => 'field_677e6b1765fc5',
'label' => __('Post Type', 'municipio'),
'name' => 'post_type',
'aria-label' => '',
'type' => 'posttype_select',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
0 => array(
0 => array(
'field' => 'field_677e6a08b2126',
'operator' => '==',
'value' => 'post_type',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'allow_null' => 0,
'multiple' => 0,
'placeholder' => '',
'disabled' => 0,
'readonly' => 0,
),
3 => array(
'key' => 'field_677e6b8534123',
'label' => __('Blog', 'municipio'),
'name' => 'blog_id',
'aria-label' => '',
'type' => 'select',
'instructions' => '',
'required' => 1,
'conditional_logic' => array(
0 => array(
0 => array(
'field' => 'field_677e6a08b2126',
'operator' => '==',
'value' => 'blog_id',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(),
'default_value' => false,
'return_format' => 'value',
'multiple' => 0,
'allow_custom' => 0,
'search_placeholder' => '',
'allow_null' => 0,
'ui' => 1,
'ajax' => 1,
'placeholder' => '',
),
),
'location' => array(
0 => array(
0 => array(
'param' => 'taxonomy',
'operator' => '==',
'value' => 'user_group',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'left',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'show_in_rest' => 0,
'acfe_display_title' => '',
'acfe_autosync' => array(
0 => 'json',
),
'acfe_form' => 0,
'acfe_meta' => '',
'acfe_note' => '',
));

}
4 changes: 4 additions & 0 deletions library/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ private function setUpMiniOrangeIntegration(): void
//Add user group to user profile & populate
$displayUserGroupTaxonomyInUserProfile = new \Municipio\Integrations\MiniOrange\DisplayUserGroupTaxonomyInUserProfile($this->wpService, $this->acfService, $config);
$displayUserGroupTaxonomyInUserProfile->addHooks();

//User group url
$populateUserGroupUrlBlogIdField = new \Municipio\Integrations\MiniOrange\PopulateUserGroupUrlBlogIdField($this->wpService);
$populateUserGroupUrlBlogIdField->addHooks();
}

/**
Expand Down
1 change: 1 addition & 0 deletions library/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
'widget-media' => 'group_5b2b70c0bde2f',
'media-attachments' => 'group_650857c9f2cce',
'hidden-validation' => 'group_654a2a57e6897',
'user-group-url' => 'group_677e6a05e347c',
));

$acfExportManager->autoExport($autoExportIds);
Expand Down
Loading
Loading