gingebaker Posted September 7, 2016 Posted September 7, 2016 Hi all... I would like to add some special javascripts files to a Inputfield if certain conditions are fullfilled. Thats working good with hook Inputfield::___render when the field is directly loaded on ProcessPageEdit. However I have problems adding these scripts when the Inputfield is not loaded directly on pageLoad. In my case a dynamically loaded repeaterItem. I found the Inputfield::renderReady method wich seems to be the best place, but it´s not hookable? ( https://github.com/processwire/processwire/blob/master/wire/core/Inputfield.php#L1030 ) ( the call in Repeater: https://github.com/processwire/processwire/blob/master/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module#L204 ) Is there an "official" way of doing that? Of course I could hook in somewhere else, but that renderReady would be the place to go or am i wrong? Thanks for any information... Tom 1
gingebaker Posted September 12, 2016 Author Posted September 12, 2016 As soon as I make the Inputfield::renderReady function hookable in core, I can add the scripts and styles for my rendering there and it also works in ajax loaded fields or repeaters. @ryan: Is there a change to make this renderReady hookable in core? thx for any information... Tom
thetuningspoon Posted October 1, 2016 Posted October 1, 2016 I am also interested in an answer to this for the AdminPageFieldEditLinks module. It looks like I would need to be able to hook renderReady() in order to load the necessary assets in repeater fields. Unless there is some other way that I haven't thought of to do this.
Robin S Posted October 1, 2016 Posted October 1, 2016 @thetuningspoon, Ryan has suggested that an alternative is to hook InputfieldWrapper::renderInputfield See his GitHub comment.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now