flyntwp / acf-field-group-composer Goto Github PK
View Code? Open in Web Editor NEWConfiguration builder for advanced custom fields field groups
License: MIT License
Configuration builder for advanced custom fields field groups
License: MIT License
Composer 2 is already a long time available (https://getcomposer.org/download/); would be great to enable the plug-in to use with composer/installers >=2.0
Hey folks,
Unfortunately, the News Feed group does not detect the button fields. What can you recommend to me?
Here is my code:
BUTTON for clone:
ACFComposer::registerFieldGroup( [
'name' => 'group_65c343f377bc4' . '_misi',
'title' => 'Buttons',
'fields' => array(
array(
'label' => 'Button',
'name' => 'button_is_visible',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'message' => '',
'default_value' => 0,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
),
array(
'label' => 'Button Link',
'name' => 'button_link',
'type' => 'acfe_advanced_link',
'instructions' => '',
'required' => 1,
'conditional_logic' => array(
array(
array(
'field' => 'button_is_visible',
'operator' => '==',
'value' => '1',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'post_type' => '',
'taxonomy' => '',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'left',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'acfe_display_title' => '',
'acfe_autosync' => '',
'acfe_form' => 0,
'acfe_meta' => '',
'acfe_note' => ''
] );
IMPORT BUTTON TO HERE
ACFComposer::registerFieldGroup( [
'name' => 'news_feeds',
'title' => 'News Feeds',
'fields' => array(
// Button field imported as clone field
array(
'label' => 'Button',
'name' => 'button',
'type' => 'clone',
'instructions' => '',
'required' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'clone' => array(
0 => 'group_65c343f377bc4' .'_misi',
),
'display' => 'seamless',
'layout' => 'block',
'prefix_label' => 0,
'prefix_name' => 0,
),
),
'location' => array(
array(
array(
'param' => 'block',
'operator' => '==',
'value' => 'acf/newscard',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'left',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'acfe_display_title' => '',
'acfe_autosync' => '',
'acfe_form' => 0,
'acfe_meta' => '',
'acfe_note' => '',
] );
Hi guys,
I studied Flynt core and all the add-ons to customise it for our own theme because Flynt has some innovative features that I haven't seen in any other theme yet. Great work!!
At the moment we create the ACF fields via the UI in combination with Local JSON, which works seamlessly, but I may want to abandon this approach for the reasons you mentioned and in the favour of better portability.
I have managed to integrate the Dynamic Render / Dynamic Preview feature of ACF Extended (https://www.acf-extended.com/features/fields/flexible-content/dynamic-render) into our custom Flynt version, but what is still missing is the ability to use the ACFE field settings with the ACF field group composer as well.
Maybe I'm overlooking something, but the acfe_flexible settings are ignored:
add_action('LB/after_register_modules', function (): void {
ACFComposer::registerFieldGroup([
'name' => 'page_modules',
'title' => __('Page Builder', 'lb'),
'style' => 'default',
'fields' => [
[
'name' => 'page_modules',
'label' => __('Page Builder', 'lb'),
'type' => 'flexible_content',
'layouts' => [
Modules\BlockImage\get_acf_layout(),
],
],
],
'location' => [
[
[
'param' => 'post_template',
'operator' => '==',
'value' => 'templates/dynamic-render.php'
]
],
],
'acfe_flexible_advanced' => 1,
'acfe_flexible_stylised_button' => 1,
'acfe_flexible_layouts_templates' => 1,
'acfe_flexible_layouts_previews' => 1,
'acfe_flexible_layouts_thumbnails' => 1,
'acfe_flexible_layouts_settings' => 0,
'acfe_flexible_layouts_locations' => 1,
'acfe_flexible_async' => array(
),
'acfe_flexible_add_actions' => array(
0 => 'toggle',
1 => 'close',
),
'acfe_flexible_remove_button' => array(
),
'acfe_flexible_modal_edit' => array(
'acfe_flexible_modal_edit_enabled' => '1',
'acfe_flexible_modal_edit_size' => 'xlarge',
),
'acfe_flexible_modal' => array(
'acfe_flexible_modal_enabled' => '1',
'acfe_flexible_modal_title' => 'Modul hinzufügen',
'acfe_flexible_modal_size' => 'full',
'acfe_flexible_modal_col' => '4',
'acfe_flexible_modal_categories' => '1',
),
'acfe_flexible_grid' => array(
'acfe_flexible_grid_enabled' => '0',
'acfe_flexible_grid_align' => 'center',
'acfe_flexible_grid_valign' => 'stretch',
'acfe_flexible_grid_wrap' => false,
),
]);
});
I believe that your Composer package would benefit enormously from an integration, as ACF Extended offers a range of features that ACF native does not support.
When trying to use a Filter like "Flynt/Components/BlockWysiwyg/Fields/Layout/SubFields" inside another filter, it returns the array of the fields as a value for the field group config instead of adding them to the flat list.
To prevent this from happening, this line probably needs to be changed to an array_reduce
:
https://github.com/flyntwp/acf-field-group-composer/blob/master/lib/ACFComposer/ResolveConfig.php#L112
Hi everyone!
First: thanks a lot for creating Flynt and this package - we've used it on a few recent projects and it's become our favourite Wordpress development stlye 🙌🏻
I could not find a solution for this specific conditional_logic case:
Problem
My field where I set the conditon is not on top level, but a subfield.
I want to select the number of columns using the button group and then the respective column WYSIWYG field should show up.
My Code
// The condition field is the "contentLayout" sub field
[
'label' => 'Aufbau',
'name' => 'contentOptions',
'type' => 'group',
'layout' => 'table',
'sub_fields' => [
[
'label' => 'Layout',
'name' => 'contentLayout',
'type' => 'button_group',
'choices' => [
'1column' => '1 Spalte',
'2columns' => '2 Spalten',
'3columns' => '3 Spalten'
],
'default_value' => '1-column'
],
[
'label' => 'Intro anzeigen',
'name' => 'has_intro',
'type' => 'true_false',
'default_value' => 0,
'ui' => 1
],
]
],
// this should be displayed when 2columns is selected
[
'label' => __('Inhalt (zweite Spalte)', 'flynt'),
'name' => 'column2Content',
'type' => 'wysiwyg',
'delay' => 1,
'media_upload' => 0,
'required' => 1,
'conditional_logic' => [
[
[
'fieldPath' => 'contentLayout',
'operator' => '==',
'value' => '2columns'
],
]
],
],
What else tried
I've also tried all of the following:
'fieldPath' => 'contentLayout',
'fieldPath' => 'contentOptions/contentLayout',
'fieldPath' => '/contentOptions/contentLayout',
'fieldPath' => './contentOptions/contentLayout',
But they all didn't work....
Questions
Is there a way to acchieve this?
For now I am going to put my contentLayout field back to the top level.
Thanks a lot for help
Aaron
Hello,
There are two notices thrown from: lib/ACFComposer/ResolveConfig.php
Line 26 needs to be changed to: $output['location'] = array_map(self::class . '::mapLocation', $output['location']);
Line 202 needs to be changed to: return array_map(self::class . '::forLocation', $locationArray);
I tried creating a PR, however, I don't have access to push anything on this project.
Defining "return_format"
for select
type fields, does not change the output that appears always to be value
.
Flynt: 0.2.1
acf-field-group-composer: 1.0.0
select
type ACF field to the component JSON file, e.g.:{
"label": "Tags",
"name": "location_tags",
"type": "select",
"choices": {
"test_a": "test_b",
"test_x": "test_y",
},
"multiple": 1,
"ui": 1,
"return_format": "label"
}
$data
into the function.php
. It'll show always the value (e.g. test_a
and test_x
), no matter which is the value of return_format
. According to ACF documentation, return_format
in this case can be label
, value
or array
but the $data
dump will always show the value.A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.