Git Product home page Git Product logo

mc-acf-flexible-template's Introduction

Hi πŸ‘‹, I'm Marie Comet

I'm a front-end web developer, based in France.

I contribute to the translation of WordPress and its documentation into French.

πŸ“ You can read me on my blog : https://mariecomet.fr/blog/

mc-acf-flexible-template's People

Contributors

acf-extended avatar mahjouba91 avatar mariecomet avatar virgo79 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  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  avatar  avatar  avatar  avatar  avatar  avatar

mc-acf-flexible-template's Issues

[Feature Request] Replace existing content

Hi,
I would like to suggest to add an option to replace the existing content when selecting a template to load. Could be very handy in many cases.

Something like in the screenshot below
replace-existing-content

Upgrading to ACF Pro 5.7.0 Creates Javascript Error In Admin

After upgrading ACF Pro to version 5.7.0, there is a new javascript error in the admin:
"Uncaught TypeError: acf.ajax.extend is not a function".
This issue is with line 8 of mc-acf-ft-template.js.

This javascript error makes a lot of things in the Wordpress admin broken.

Incorrect use of acf.do_action( 'validation_begin' )

Describe the bug
In the file \mc-acf-flexible-template\assets\js\mc-acf-ft-template.js line:195:
The code acf.do_action( 'validation_begin' ); is incorrect, as it's not providing form.$el as it should. This can lead to errors if other plugins hook on validation_begin expecting a parameter.

For reference, here is the original hook by ACF:
File: \advanced-custom-fields-pro\assets\js\acf-input.js line:13043
acf.doAction('validation_begin', this.$el);

To fix the issue:
acf.do_action( 'validation_begin' ); should be replaced by:
acf.doAction('validation_begin', $form);

Regards.

Template Names

Great work on the plugin!

I noticed that when saving templates, they can have the same name, e.g. if you save a template 'Test' you can then save another template 'Test'. Is it possible to give an alert to the user if saving a template that already has that name (or append a number to the template name)?

inter-site import/export a.k.a. site-independant serialization

ACF template helps me translating complex flexible field contents from one site to another one.

Describe the solution you'd like
I'd like to be able to export/import a template from one WordPress instance to another.
It'd only include attached images if importer was told so at the time of import.

Describe alternatives you've considered
Since ACF templates are custom post types. I thought standard tools would support it out of the box.

  • export : Exporting acf-templates as a WXR file works (although see below about serialization).
  • import: Assuming an "import plugin" is enabled (I tried rmccue's WordPress Importer v2), it also works

This results in a new ACF template :

  1. Being imported and created
  2. Being listed
  3. Having its correct meta attached
  4. Whic appears as empty in the template editor UI.

Additional context
Templates are mostly stored in a _flex_layout_data which is serialized.
But "here is the point" : the serialized form is not "installation-independant". It's probably related to why imported templates are shown as empty.

Flexible Content within Flexible Content

Hey I have been using your plugin for a while now and it is awesome, thank you for your hard work!

I have changed a few things with how my content is captured in the backend and I have run into an issue.

The main part of my content is a flexible content field where I can add sections. One of the sections also contains a flexible content field with in it that I add more sub sections.

When I save the main section flexible content items as a template, the inner flexible content fields become messed up and breaks the content.

screen shot 2018-06-25 at 7 19 12 pm

The image above shows the saved flexible content template. As you can see the 'Page Content' field is a flexible content field has the 'Columns' Flexible Content field, with two items assigned. The layout and content is saving to the ACF Template CPT correctly.

screen shot 2018-06-25 at 7 16 58 pm

The image above shows what happens when I import the saved template back into the Page Content Flexible Content area. As you can see the inner Flexible Content field that contains the two Wysiwyg Editor fields has duplicated. It appears the whole inner Flexible Content field has duplicated as you can see two "Add Column" buttons in it.

I hope you understand my issue. I love using your plugin. If you know how we can fix this issue and help is much appreciated.

Thanks in advanced, Peter

Fails with ACF 5.10

Describe the bug
Stopped working with ACF 5.10

To Reproduce
The "Save template" tooltip containing Name the template : * does not show the name text input anymore.

Screenshots
Screenshot from 2021-10-20 15-33-30

WordPress and ACF Versions
WordPress version :
ACF version: 5.10
ACF Pro version: 5.10

The reason is that acf_render_field_label now uses acf_esc_html() which strips the necessary markup.

Can't save or load from clone

Bug Description

When a flexible content field is loaded in to another group via ACF's built-in clone field the plugin struggles to load or save templates for the given field.

Reproduce

  1. Create a "Component Selector" ACF group with a single flexible content field.
    • add some example layouts to the flexible content field
  2. Create a "Layout Builder" ACF group with a single repeater field.
    • in the repeater field, add a clone field
    • set the Fields option to ourComponent Selector (all fields)
    • make sure that the Display options is set to "seamless"
  3. Create a new post
    • create a "layout" in our repeater
    • add some "components" to our inner flexible content field

Expected Behavior

I'd expect to see the load/save buttons above each "component" (which I do!) and be able to, well.... use them. That is, to be able to save and then load any given component layout as a template.

The "actual behavior" when I try to save one of my component's is to give a bit of vague messaging (see screenshot) and then nothing... nor does the template get added to the "ACF Templates" tab...

This is probably a pretty complex/inane ACF setup β€”Β the plugin works great in the simpler scenarios I tested! Still,Β it'd be very useful for me in this particular instance. So if you do have a chance to work out this kink it'd be much appreciated. (Happy to help if/where I can...)

Screenshots

image
the error when I try to "Save" a layout template

Versions

  • WordPress: v4.9.6
  • ACF: ACF Pro, v5.7.0
  • ACF Add Ons
    • Repeater Field v2.1.0
    • Flexible Content Field, v2.1.0

Your Plugin has a lot of potential, great work!!!

Hi Marie,
Today, I discovered your plugin, and it is what I always needed since I use the flexible content a lot.

I found some cases when the "Load template" and "Save template" buttons are not displayed.

  1. If the flexible content field is loaded with a clone field
    grafik

  2. When the Field Group has more than one field type, for example, a text field and then a flexible content:
    grafik

for case 1
I looked at the class MC_Acf_Flexible_Template, and I added to the actions the type=clone

// add option settings in flexible field
add_action( 'acf/render_field_settings/type=flexible_content', array( $this, 'mc_ft_acf_field_groups_add_settings' ), 10, 1 );
// add option settings in flexible field clone
add_action( 'acf/render_field_settings/type=clone', array( $this, 'mc_ft_acf_field_groups_add_settings' ), 10, 1 );

grafik

But I couldn't find how to display the save buttons.

Carlos

Awesome plugin !

Hey, your plugin is so great but I got a question : why don't you add a system to duplicate layouts ?
Because your plugin already allows to import a same layout several times in a row, which is certain way of a duplication. With this option in addition I would buy that plugin without hesitation.
Think about getting rich ;)

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.