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

Support for ACF Extended #30

Open
rikhen opened this issue Feb 28, 2024 · 1 comment
Open

Support for ACF Extended #30

rikhen opened this issue Feb 28, 2024 · 1 comment

Comments

@rikhen
Copy link

rikhen commented Feb 28, 2024

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
Copy link
Author

rikhen commented Feb 28, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant