MarieComet / mc-acf-flexible-template

WordPress plugin makes it possible to save the ACF flexible content fields as templates
71 stars 20 forks source link

[Feature Request] Replace existing content #11

Closed virgo79 closed 5 years ago

virgo79 commented 5 years ago

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

MarieComet commented 5 years ago

Hi @virgo79, thanks for the idea. I add it to my todo-list.

MarieComet commented 5 years ago

Hi @virgo79, thanks for you PR, merged here https://github.com/MarieComet/mc-acf-flexible-template/commit/4dba3536c089297b661d4458c32e08ce11ce04b9 I made some little changes in the code.

virgo79 commented 5 years ago

Hi Marie, thanks to you for creating acf-flexible-template. I'm a bit newbie in github, and Forking and pull requests are my first steps. I would ask to you how I can create other pull requests. It's not so celar for me. Recently, I've submitted to you a PR that has been merged. But now there are other PR in queue: how I can create another PR without having conflicts with other contributors? If you can could yiu point me to the right direction? Thanks in advance :) Virgilio

Il giorno gio 1 nov 2018 alle ore 15:45 Marie Comet < notifications@github.com> ha scritto:

Hi @virgo79 https://github.com/virgo79, thanks for you PR, merged here 4dba353 https://github.com/MarieComet/mc-acf-flexible-template/commit/4dba3536c089297b661d4458c32e08ce11ce04b9 I made some little changes in the code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarieComet/mc-acf-flexible-template/issues/11#issuecomment-435056055, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQ2n1BzLrMMJVSCKtGhsVjluZFP1erfks5uqwkVgaJpZM4XxM0y .

MarieComet commented 5 years ago

Hi Virgilio,

When you fork a repository, you need to keep your fork up-to-date with the original repositoy, including to manage your pull requests.

A little example :

On January 1st, you fork the Marie's repository and you are up-to-date with its content.

During January month, you develop some things on your own fork, and on February 1st, you create a Pull Request to propose to Marie your changes.

During the January month, other developers have created PRs which have been merged.

So, your fork is not up-to-date comparing to the February 1st content of the Marie's repository. So you need to merge the changes made during January month to your code using this kind of tutorial https://help.github.com/articles/syncing-a-fork/ After that, your code will not conflict with master branch when you will create your PR.

So if you create a PR on this repo and if your fork has conflict with the master branch when I look your PR, I will reject it and you'll need to create another one (if you want).

I hope it's clear :)

virgo79 commented 5 years ago

Hi Marie,

thank you very much for clarifications. Syncing a fork was the missing tile. I supposed there would be such a system like this, but there is no any action button in github website. Maybe is more easy to do this using git in local machine, but currently I'm using github website only.

Anyway, all this means that contributors should be careful when creating pull request. Expecially when two ore more are working on the same files at the same time. I suppose that someone have to wait to sync its fork with previous pull requests before creating another pull request.

thank you very much, really clear! :)

Returning to your plugin mc-acf-flexible-templates, I would like submit another pull request related to the mc_ft_acf_update_template function. This function is hooked with the acf/save_post filter and the purpose is to update the post_meta fields (_flex_layout_parent and _flex_layout_data) without saving any $_POST['acf'] data into the database. Currently the function loop through all fields and everytime find a non empty value in $_POST['acf'], it updates the _flex_layout_data. Thi means that we cannot use or create other acf fields into the post screen. This prevent users to extended the acf_template post type screen with other acf fields. I've rewritten a bit of this function so we can get the specific flexible template data using the _flex_layout_parent field key instead of looping through the available fields. Currently I'm using this method in a local version of the plugin. And this give me the ability to extend the acf_template screen addiing extra acf fields (for example a screenshot of the template). If you find useful this idea I can create another Pull Request, so maybe you can dive more clearly into what I'm try to say.

Please, let me know what you think, thank you very much! Virgilio

Il giorno ven 2 nov 2018 alle ore 21:23 Marie Comet < notifications@github.com> ha scritto:

Hi Virgilio,

When you fork a repository, you need to keep your fork up-to-date with the original repositoy, including to manage your pull requests.

A little example :

On January 1st, you fork the Marie's repository and you are up-to-date with its content.

During January month, you develop some things on your own fork, and on February 1st, you create a Pull Request to propose to Marie your changes.

During the January month, other developers have created PRs which have been merged.

So, your fork is not up-to-date comparing to the February 1st content of the Marie's repository. So you need to merge the changes made during January month to your code using this kind of tutorial https://help.github.com/articles/syncing-a-fork/ After that, your code will not conflict with master branch when you will create your PR.

So if you create a PR on this repo and if your fork has conflict with the master branch when I look your PR, I will reject it and you'll need to create another one (if you want).

I hope it's clear :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarieComet/mc-acf-flexible-template/issues/11#issuecomment-435488223, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQ2nzE7HMKhzDMBxlGwMPK_9bQ9zAPJks5urKnQgaJpZM4XxM0y .