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

Added method for removing a content hook #69

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@funkjedi
Copy link
Contributor

funkjedi commented Mar 5, 2015

Adding method that will remove a content hook and restore the field back to its initial state.

// Remove content hooks from ACF Repeater and Flexible Fields clones
jQuery('.acf-clone .wp-editor-area.qtranxs-translatable').each(function() {
    qTranslateConfig.qtx.removeContentHook(this);
});
@johnclause

This comment has been minimized.

Copy link
Member

johnclause commented Mar 10, 2015

Hi Tim, what is the status on this? Do you still need this? Why would you need to remove a hook, if we can not to add it to begin with?

@funkjedi

This comment has been minimized.

Copy link
Contributor Author

funkjedi commented Mar 10, 2015

There are two specific use cases both relating to adding and removing custom fields on the fly.

1) ACF keeps a set of dummy fields which are cloned in JS when a user adds a new row of repeatable fields. The problem is that when on post.php or post-new.php all textareas with the .wp-editor-area class automatically have content hooks added to them. This means the hidden dummy fields now have content hooks. When these fields are cloned to make the new set of fields it copies the modifications made by the content hooks. Which prevents us from adding content hooks to the new fields.

2) If the user removes a set of repeatable fields the content hooks need to be removed. Otherwise when the form is submitted the mlContentField fields will still contain the deleted fields. Resulting in the data not actually being deleted.

@johnclause

This comment has been minimized.

Copy link
Member

johnclause commented Mar 10, 2015

I pushed this to the latest master on github. Is there anything else needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.