Within the example Custom View Tags’ (& Extensions’) *.zip files I can see how to use node.js script to compile “CustomViewTemplate” properties that will replace fields on View Pages that have the associated “Custom View Tag” Field set.
So a custom View Tags’ js-within-zip looks like this:
— mycustomviewtag.zip → mycustomviewtag.js
global.mycustomviewtag= {
Name: “mycustomviewtag”,
CustomViewTemplate: function(o, tbl, fld, ctrl){
return <input type="text" readonly="" class="form-control-plaintext" value="<?php echo my_global_php_function(CurrentTable()->${fld.FldParm}->CurrentValue); ?>">;
}
}
But I could not find any examples of using the same pattern for Custom EDIT Tags.
What I have tried:
Tag inside mycustomedittag.xml
I could see the use of the tag inside of the colorpicker.xml, but this doesn’t seem to allow me to access the field name/value in my PHP function (ie. I can’t see how to do the equivalent of “CurrentTable()->${fld.FldParm}->CurrentValue” in my custom edit tag’s PHP).
Of course, it does allow me to access {{{value}}} in my client-side code. However I need the field name & current value server-side, in the custom edit tag’s PHP.
- CustomViewTemplate" & “CustomEditTemplate” in mycustomedittag.zip → mycustomedittag.js
I tried a “CustomViewTemplate” and a “CustomEditTemplate” (guessing!) property inside a js-within-zip for a Custom EDIT Tag. But it just seems to get ignored. “CustomViewTemplate” works fine for my testing with Custom VIEW Tags using the js-within-zip pattern.
- Read the Help file!
I read the help file extensively but all of the examples are worded similar to “<?php if (CurrentPage()->MyField->CurrentValue == "xxx")....?>”. That is, it is assumed that we know the value of “MyField”. But the only way I can find to get MyField so far in a Custom View/Edit Tag is using the “${fld.FldParm}” in the js-within-zip pattern as above.
- Cleared the Template Cache, Rezipped, etc
Throughout all of this testing I was fanatical about clearing the template cache, replacing the xml & zip files after any updates, etc. So I’m sure it’s not a “did you test on the old file” thing.
So, my questions are:
A) Is it possible to use the js-within-zip pattern for Custom Edit Tags?
B) Is it possible to access the field’s name & current value within Custom Edit Tags (using js-within-zip, xml , or another method)?
Any help very much appreciated!