Closed (fixed)
Project:
Image Gallery Management
Version:
6.x-1.0-beta4
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
10 Sep 2009 at 15:56 UTC
Updated:
29 Sep 2009 at 19:10 UTC
I wanted to explore this module. I still don't know if it's what I need but it was missing a little code. I got this error [10-Sep-2009 09:39:52] PHP Fatal error: Call to undefined function _image_gallery_parent_select() in /home/thechefs/public_html/sites/all/modules/gallery_manage/gallery_manage.module on line 165 so I googled _image_gallery_parent_select and found the function at http://api.lullabot.com/_image_gallery_parent_select. I figured that I should just cut and paste into the module, saved it, upload it and it seems to work.
I'm going to have a look at the module and see if it works now. I'll get back to you on it.
Here is the code to put in the module.
function _image_gallery_parent_select($tid, $title) {
$parents = taxonomy_get_parents($tid);
if ($parents) {
$parent = array_shift($parents);
$parent = $parent->tid;
}
else {
$parent = 0;
}
$children = taxonomy_get_tree(_image_gallery_get_vid(), $tid);
// A term can't be the child of itself, nor of its children.
foreach ($children as $child) {
$exclude[] = $child->tid;
}
$exclude[] = $tid;
$tree = taxonomy_get_tree(_image_gallery_get_vid());
$options[0] = '<'. t('root') .'>';
if ($tree) {
foreach ($tree as $term) {
if (!in_array($term->tid, $exclude)) {
$options[$term->tid] = str_repeat(' -- ', $term->depth) .' '. $term->name;
}
}
}
return array(
'#type' => 'select',
'#title' => $title,
'#default_value' => $parent,
'#options' => $options,
'#description' => t('Image galleries may be nested below other galleries.'),
'#required' => TRUE
);
}
Comments
Comment #1
Adam S commentedThe function does exist somewhere else and the some where else and it did conflict with the function so I just renamed it by adding another character to it. All seems fine so far. Does anybody have a better idea than just hacking it?
Comment #2
rkolech commentedHello, I am having the same issue. I just did the beta3 update, and was poking around making sure everything is working well. That's when I came across this error. I am kind of a Drupal/PHP noob though so my module hacking skills are somewhat lacking. I would also like to see a solution to the issue.
For now I just added the function indicated above to the end of the sites/all/modules/gallery_manage/gallery_manage.module file. Seems to be working fine now.
Comment #3
jchan commentedThis is now fixed in 1.0-beta4.
Notes:
The new version of the image_gallery module (not to be confused with this gallery_manage module) has split off its admin functions into a separate file. And that file only gets loaded by Drupal when the image_gallery module needs it. In other words, gallery_manage lost its access to some image_gallery functions. Hence the fatal error.
In order to preserve compatibility with prior versions of image_gallery, and to prevent the conflict noted by adamsohn in #1, I have duplicated the function under a new name: _gallery_manage_parent_select().