GithubHelp home page GithubHelp logo

flyntwp / acf-field-group-composer Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 12.0 125 KB

Configuration builder for advanced custom fields field groups

License: MIT License

PHP 100.00%
advanced-custom-fields acf wordpress

acf-field-group-composer's People

Contributors

domtra avatar emcarru avatar harunbleech avatar jgrubbs avatar maxduyck avatar thomasnavarro avatar usingthesystem avatar vandebled avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

acf-field-group-composer's Issues

How can I utilize the cloned elements effectively?

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' => '',
] );

Support for ACF Extended

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.

Conditional Logic when Condition field is a subfield

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.

Screenshot 2021-05-06 at 10 34 11

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

Deprecated notice with PHP 8.2

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.

Ignored return_format on select type ACF fields

Overview of the Issue

Defining "return_format" for select type fields, does not change the output that appears always to be value.

Flynt Version

Flynt: 0.2.1
acf-field-group-composer: 1.0.0

Reproduce the Error

  1. Add a 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"
}
  1. Dump the $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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.