ExtensionDesign-Talk
This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.
SDVA ()
What are the advantages of and reasons for using SDVA ()
to initialise the default configurations variables that are passed to extGetConfig ()
?
SDVA() "Set default values array" can be used it you want to allow for an administrator to redefine some of the default values in PHP, like in classic recipes. This may be desirable to reduce the configurations saved to disk, or in a wiki farm. --Petko
Resource in footer
I probably did something wrong, but a report could be useful: I tried extAddResource('mycookies.js', 1); in MyExtension.php, but cookies didn't work without the string $HTMLFooterFmt
[]...$ExtPubDirUrl/... in farmconfig. Then I tried with priority 90, but at that point I couldn't log in anymore... so I had to delete the priority (line) manually from wiki.d/extensions/Extensions.Config. - Frank
It should probably be (for the footer):extAddResource('mycookies.js', [], 1);
The second argument is an array of HTML attributes for the resources. I thought the resources in the header would be most frequently needed, attributes would be more frequently needed than footer resources. I was wondering if it would make it more obvious to switch the last 2 arguments (so your line would work). How do you feel about it? --Petko
Well, with the second argument yes, now cookies work, as you said. Having no attributes for the footer, I didn't think it was necessary. Sorry, dumb mistake. Thank you. - Frank
In order to simplify this and make it more obvious, I've added 2 helper functions extAddHeaderResource('mycookies.js');
and extAddFooterResource('mycookies.js');
in version 2024-04-10. The previous function still works. --Petko
Talk page for the ExtensionDesign recipe (users?).