This is a very simple change that adds a drupal_alter hook into the wysiwyg_template_load_all function. This allows developers to modify the array just prior to presentation in the template plugin. The advantage of adding this hook (as an example) is that you could contextually modify the options presented to users based on who they are or add a default image if one hasn't been provided.
I've got this working the textbook module to add in a default image for each packaged (as a feature) template. This way you don't need to create file references just to have a packaged template included by default on a new site using the modules.
Comment | File | Size | Author |
---|---|---|---|
#1 | template-alter-hook-1915464-1.patch | 337 bytes | btopro |
Comments
Comment #1
btopro CreditAttribution: btopro commentedincluded patch to add a hook_wysiwyg_templates_load_alter hook
Comment #2
guybedford CreditAttribution: guybedford commentedSure, no reason not to. I've added this to the current 7.x dev branch.
Comment #3
btopro CreditAttribution: btopro commentedIn looking at the patch as it was applied it was added to the wrong line. It should be outside the loop as the patch indicates but was applied inside the foreach loop, causing it to be called too many times but also not at the right point in the operation to be effective.
Comment #4
guybedford CreditAttribution: guybedford commentedThanks for catching this! You can see we need a new maintainer... Have fixed.