I keep getting this strange error and not quite sure where exactly to fix it.
On a fresh Drupal 7.33 install w/ PM and dependencies and PM-Org and PM-Proj enabled I create Org content just fine. It works great.
When trying on several different distributions (i.e. commons-7-x-3-19 with just PM) I get the error.
It easy enough to fix though, I just go to the /includes/common.inc file on line 2439 and remove the "[] operator" and it works fine ... the problem of course is this hacks core.
The real fix appears to be detailed here --> https://www.drupal.org/node/1084308#comment-7954765 ...
but not sure where to apply it, or really even if its a PM thing. I'm guessing it is though since hacking core "fixes" it.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | pm-change-class-to-array-2376213-4.patch | 1.17 KB | malik.kotob |
Comments
Comment #1
d34dman commentedPlease do not kill the kittens :(
hacking core is not a solution.
I have just downloaded the version of Drupal Commons. From reading the code i understand the issue arises when inside the l() function (link), when it tries to add an extra active class, its failing. Relevant code under inspection below..
This should be some migration issue from Drupal 6 to Drupal 7 went undetected. Thanks for reporting the error. Right now am working on some other part which is consuming much of my time. Push this to high priority if anybody could replicate it with latest D7.
Another way to speed up the debugging process would be to paste a backtrace if available.
Comment #2
juliangb commentedI've just tested this, but couldn't reproduce the error.
But it means I have a commons build running with PM already now, so if you're able to point me towards the page I should be able to find the bug fairly easily.
Please could you post as much as possible in terms of when you see the error, and what you do just beforehand?
Comment #3
juliangb commentedComment #4
malik.kotob commentedI received the same error after clicking on the "+" (Add) icon when trying to add a new Project (and also when trying to add an Organization).
Steps to reproduce:
1) Installed and enabled the PM module (v 7.x-2.0)
1.a) More specifically, I enabled Project Management, PM Project, PM Tasks, PM Organizations, PM Permissions
2) Added the Project Management Menu block to the Bottom of content Region (/admin/structure/block)
3) Clicked the "+" (Add) icon next to "Projects" from the newly added Project Management Menu
At that point I received the error message you mentioned. I agree with @D34dMan that the issue occurred when trying to append the 'active' class. In this case, it was trying to add an active class to the anchor tag for the add link.
From pm.module:
$attributes = array('class' => 'popups-form');
The issue is that the class itself needs to be array (that is mentioned on the link @dbt102 posted: https://www.drupal.org/node/1084308#comment-7954765)
Updated version:
$attributes = array('class' => array('popups-form'));
I saw that the code was setting the class the same way for the edit and delete icons, so I applied the fix in three places total in pm.module (add/edit/delete). I wasn't able to test the edit/delete, however, because I don't see those two icons rendering when I add the Project Management Menu block.
/**
* Provides a Project Management add icon.
*/
function pm_icon_add($path, $params = array()) {
$attributes = array('class' => 'popups-form');
return pm_icon_l('application_add', $path, t('Add'), $params, $attributes);
}
/**
* Provides a Project Management edit icon.
*/
function pm_icon_edit($path, $params = array()) {
$attributes = array('class' => 'popups-form');
return pm_icon_l('application_edit', $path, t('Edit'), $params, $attributes);
}
/**
* Provides a Project Management delete icon.
*/
function pm_icon_delete($path, $params = array()) {
$attributes = array('class' => 'popups-form');
return pm_icon_l('application_delete', $path, t('Delete'), $params, $attributes);
}
I created a patch and tested locally, it seems to have fixed the issue when adding organizations/projects etc.
I apologize if the detail is excessive, but wanted to ensure there was enough info to look into the patch. Glad to apply what I've learned after participating in a 13-week Drupal boot camp with http://debugacademy.com (Really great program). Let me know if I need to make any changes!
Comment #5
d34dman commentedHello Malik,
Glad to see you have provided a patch. Much appreciated. By reading the patch i can see that it was indeed a D6 to D7 migration issue went undetected. Thanks for looking into it. I am sure it would fix the issues. Relevant issue on D.O. migration guide here.
Incidentally i would like to introduce this project that makes it reviewing patches easier https://dreditor.org/ .
Comment #8
juliangb commentedThanks for the patch!
Applied to both 7.x-2.x and 7.x-1.x.
Comment #10
malik.kotob commentedComment #11
d34dman commented@malik.kotob, i can't see any comment ?? what happened?
Comment #12
malik.kotob commented@D34dMan that's odd. I don't recall commenting. I recently changed my drupal.org username from mkotob to malik.kotob. I'm wondering if that could have anything to do with it. Sorry about that!
Comment #14
juliangb commentedTest bot has only just tested the patch as 7.x-2.x tests that were failing now pass.