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

Better integration/tolerance with the existing Craft MatrixInput JavaScript #41

Closed
timmyomahony opened this issue Jul 17, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@timmyomahony
Copy link
Owner

For the plugin to work we need to be able to make use of the MatrixInput JavaScript for each matrix field rendered on the page.

Craft stores reference to this class on the <div class="matrix-field ..."> element's DOM/$.data() so we can get access via:

var matrixInput = $matrixField.data("matrix");

The problem is there is no guarantee that Craft has finished loading the MatrixInput for any particular class. For example, if you do this immediately on the page load, matrixInput is undefined. JQuery doesn't have any build in listener for this, nor does Craft seem to have any registration pattern that you can use to listen for when the input has stopped rendering. Therefore the best you can do is either delay, or do some sort of back-off check.

@timmyomahony timmyomahony added the bug Something isn't working label Jul 17, 2020
@timmyomahony
Copy link
Owner Author

This is fixed now in 1.2.0

https://github.com/weareferal/craft-matrix-field-preview/releases/tag/1.2.0

I realised that you can use the Garnish event system to listen for the afterInit event that Matrix inputs and Neo inputs fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant