Hello,
I am using Patterns with Drupal 6.20 (on a Turnkey LAMP virtual appliance - Ubuntu 8.04).
I successfully used this module to write patterns to configure automatically other modules and I must thank you for this module because it saved me a lot of time. But I encounter problems configuring the wysiwyg ckeditor profile (i.e: I am using ckeditor integration with wysiwyg module).
In the attachments you can see what I want to configure automatically:
- image1.png: ckeditor profile is already configured for Full HTML and Filtered HTML (this is ok).
- image2.png: when selecting Full HTML the default state is no checkbox selected for all buttons. I want to select all the checkboxes automatically with a pattern (otherwise I have to do it manually each time for each new installation).
To do the task described above, I have written the following pattern (in attachment):
- pattern1.xml: the following error is thrown:
"Pattern wysiwyg_ckeditor (sites/default/files/patterns/wysiwyg_ckeditor.xml)
Action #1: System: Execute form (op "execute")
PHP error occured:
warning: Missing argument 2 for wysiwyg_profile_form() in /var/www/sites/all/modules/wysiwyg/wysiwyg.admin.inc on line 12.".
- pattern2.xml: I tried to add the second argument, which seems to be wrong because the pattern ran successfully, but nothing was configured... see image3.png (only default values taken, buttons not configured)
So my question: is it possible with the current implementation of patterns to do such a task ? Or is it a task that is too complicated ? I have no ideas how I could find out which second argument is needed and which syntax I have to use to write this second argument in a pattern form.
Could you please tell me:
- if you think it is possible ?
- if someone once tried to do the same ?
- how I can find out which argument is needed and how can I write it in XML ?
Many thanks in advance for your help !
Jonathan.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | wysiwyg_ckeditor_new.xml_.txt | 6.76 KB | foufure |
| #2 | image1_ok.png | 28.27 KB | foufure |
| #2 | image2_nok.png | 30.37 KB | foufure |
| #1 | profile-var.png | 76.5 KB | vaish |
| image3.png | 29.19 KB | foufure |
Comments
Comment #1
vaish commentedThanks for a very detailed support request.
Key to finding which argument is missing is the warning you got: Missing argument 2 for wysiwyg_profile_form() in /var/www/sites/all/modules/wysiwyg/wysiwyg.admin.inc on line 12."
You need to open the file wysiwyg.admin.inc and go to line 12. There you will find that second argument is $profile.
function wysiwyg_profile_form($form_state, $profile) {Now you need to find out what is the type and content of $profile arg so that you can emulate the same in your pattern. For that you can use your favorite var dump PHP function. It turns out $profile is an object and its content is shown in the attached image. Patterns don't support passing in object arguments but luckily in this case this arg is cast into array before being used in the function so there is a good chance passing an array instead of object should work here.
You can see patterns doc page at http://drupal.org/node/408960 for an example of how to pass additional arguments. Only YAML example is available but I think you should be able to figure out how to convert it into XML.
Comment #2
foufure commentedThanks for your help. I adapted my xml file and I had some major improvements.
The only thing that does not work is configuring all the "buttons", because of the interpretation of the "default" array type:
- when I do the edition by hand, then the "default" array is made of Integers (see Image1_ok.png)
- when I execute my pattern (wysiwyg_ckeditor_new.xml.txt) in attachment, the "default" array is made of Booleans, and it does not work (see image2_nok.png). What is strange is, that for example the "imce" array is made of Integers...
Do you have an idea why the assumption is made, that the array must be of Booleans instead of Integers ?
Is there a way in the pattern to force the "default" array (for the buttons) to Integer instead of Boolean ?
Comment #3
vaish commentedIt seems that you have run into the issue already described here: #848372: It would be nice to allow for mixed-case tag names
I just committed a fix for the above issue. Your pattern should work correctly now.
Comment #4
foufure commentedThanks for your update ! I installed the new version of the pattern module and now my pattern works perfectly !
One last question. In reply #1 you said: "Now you need to find out what is the type and content of $profile arg so that you can emulate the same in your pattern. For that you can use your favorite var dump PHP function. " and you attached the screenshot "profile-var.png". How did you exactly dumped this variable so that it appeared as in "profile-var.png" on your website ? Before you sent me this information I did not even know this was possible... I have still a lot to learn... Maybe do you have a link on a tutorial or a post on how doing this, if it is too complicated to explain it in a few words ?
Comment #5
vaish commentedInstead of using standard PHP's dump functions like print_r() or var_dump(), when working with Drupal you can use functions provided by devel module that are wrappers around PHP's dump functions. Those functions will output the dump to the "message" area of the page and additionally use Krumo to produce nice readable output as seen on the screenshot. You can check out the source of devel module and look for the functions like dpm(), dvm(), etc.