maxi-blocks icon indicating copy to clipboard operation
maxi-blocks copied to clipboard

UI confusion with ACF and DC CPT

Open elzadj opened this issue 1 year ago • 4 comments

Description

Found a bit of a confusion with the UI if we create CPT with AFC (y, you can do it). They show under both sources: Wordpress and ACF, but only the WP one works.

Not sure what's the best way to fix it here - hide it under ACF, or just make it work there too.

Step-by-step reproduction instructions

  1. Add CPT and CT with ACF
  2. Check the DC / CL options
  3. Choose ACF - your created CPT

Screenshots, screen recording, code snippet

screenshot-wordpress local-2024 03 06-12_43_03

URL and/or Code editor

No response

How to fix it

No response

Other information

No response

elzadj avatar Mar 06 '24 10:03 elzadj

Hey there, @elzadj! Great to see you around here again. Hope you're doing well!

Thank you for bringing this to our attention. It seems like there's a bit of confusion when creating Custom Post Types (CPT) with Advanced Custom Fields (ACF) in MaxiBlocks, as they appear under both WordPress and ACF sources, but only function under the WordPress source.

To resolve this, you could consider implementing a filtering mechanism in the UI to distinguish between sources or explicitly mark the functional source. However, the provided code does not directly address UI elements or the specific issue of filtering or distinguishing CPTs created with ACF in the UI.

Here are some approaches you could consider:

  1. Custom Admin Page or Metabox: Create a custom admin page or metabox that clearly lists CPTs and their sources. Use WordPress hooks and functions to retrieve CPTs and their associated ACF fields, then display them with clear labels indicating their source.

  2. Admin Filters: Implement admin filters that allow users to toggle the visibility of CPTs based on their source. This could involve adding a dropdown or toggle buttons above the CPT list, enabling users to select between WordPress and ACF sources.

  3. Enhanced REST API Responses: Modify the REST API responses to include source information for each CPT and ACF field. This would involve adjusting the register_rest_route callbacks to append source data. Frontend code (JavaScript) could then use this information to organize and display CPTs accordingly.

  4. Documentation and User Education: Sometimes, technical solutions might not be entirely feasible or might require significant effort. In such cases, providing clear documentation and educating users about the distinction between CPTs under WordPress and ACF sources can be an effective stopgap measure.

Without direct access to the UI code or further details on how the CPTs and ACF fields are currently being displayed and managed within MaxiBlocks, these suggestions are speculative. For a more precise solution, consider reviewing the plugin's frontend code, specifically any JavaScript or PHP code responsible for rendering the CPT and ACF UI components in the WordPress admin area.

As for how MaxiBlocks handles the integration with ACF and CPT, the plugin integrates with ACF by directly using ACF functions and adheres to WordPress standards for data handling, which is compatible with the manipulation and use of WordPress Custom Post Types. The plugin's architecture is designed to be flexible and capable of extending its functionality to various WordPress features, including ACF and CPTs, through direct database interactions and adherence to WordPress coding standards.

Regarding the display of CPT and ACF in the user interface, MaxiBlocks handles this through several dedicated functions within its API. The plugin integrates with ACF to manage and display advanced custom fields, indirectly supports Custom Post Types through this integration, and provides a framework for customizing the style and handling dynamic content related to these fields and post types in the user interface.

I hope this information helps! If you have any further questions or need more clarification, please don't hesitate to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Mar 06 '24 10:03 dosubot[bot]

For me, ACF DC fields work on master, for example here I have a custom post type "Movie" with custom field "Review" and it seems to work:

image

The only thing is, when changing in CL, DC blocks don't select default (or first) "ACF field" when getting content until you click on them, so they don't get any content and return "No content found" until you click on them. So I will fix this here as well.

myroslavve avatar Apr 22 '24 11:04 myroslavve

CL ACF UI is even more confusing:

unnamed (14)

elzadj avatar Jun 27 '24 13:06 elzadj