acf-field-group-composer icon indicating copy to clipboard operation
acf-field-group-composer copied to clipboard

Support for ACF Extended

Open rikhen opened this issue 1 year ago • 1 comments

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.

rikhen avatar Feb 28 '24 07:02 rikhen

Looks like I had a formatting issue with the nesting of the "acfe_flexible" keys, my bad. Now it seems to be working:

add_action('LB/after_register_modules', function (): void {
	ACFComposer::registerFieldGroup([
		'name' => 'page_modules',
		'title' => __('Page Builder', 'lb'),
		'style' => 'default',
		'fields' => [
			[
				'name' => 'page_modules',
				'label' => __('Layout', 'lb'),
				'type' => 'flexible_content',
				'button_label' => __('Add Module', 'lb'),
				'layouts' => [
					Modules\BlockImage\get_acf_layout(),
				],
				'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,
				),
			],
		],
		'location' => [
			[
				[
					'param' => 'post_template',
					'operator' => '==',
					'value' => 'templates/dynamic-render.php'
				]
			],
		],
	]);
});

However, are there any known limitations to the supported field types?

rikhen avatar Feb 28 '24 10:02 rikhen