I've patched the module. It works on our site. Please check the code to tell us if it's secure and drupal code compliant enough.
You'll see the code added between the commented lines 416 to 436 (// dev-label-080401), under the function taxonomy_quick_find_view_block($delta) { of * Function to get the contents for a block. This also includes the Javascript too. :
// dev-label-080401 : display the nodetype "name" instead of the nodetype "type"
$result = db_query('SELECT distinct n.nid, n.title, nt.name FROM ({node_type} nt INNER JOIN {node} n USING (type)) INNER JOIN {term_node} tn USING (nid) WHERE n.type = "%s" AND n.status = 1 AND tn.tid = %d ORDER BY n.created DESC LIMIT %d', $type, $preset, $settings['limit']);
if ($result && db_num_rows($result) > 0) {
$items = array();
while ($node = db_fetch_object($result)) {
$items[] = l($node->title, 'node/' . $node->nid);
$nodetypename=$node->name; // new variable contains the node type name
}
$output .= theme('item_list', $items, ucwords(t($nodetypename)), 'ul', array('class' => 'tqf_' . $type));
}
else {
// if the previous query has no result then we create another query
$result = db_query('SELECT distinct n.nid, nt.name FROM {node_type} nt INNER JOIN {node} n USING (type) WHERE n.type = "%s" AND n.status = 1 ORDER BY n.created DESC LIMIT %d', $type, $preset, $settings['limit']);
db_num_rows($result);
$node = db_fetch_object($result);
$nodetypename=$node->name;
// dev-label-080401 : display the nodetype "name" instead of the nodetype "type"
$output .= theme('item_list', array(t('Aucun résultat associé.')), ucwords(t($nodetypename)), 'ul', array('class' => 'tqf_' . $type));
}
}
return $output;
}
else {
return '';
}
}
Thank you
Comments
Comment #1
ali27 commentedJust assigning the patch
Comment #2
nicholasthompsonThere is a function in Drupal to handle the requesting of node type names. I will add this feature separarely using that if needed.
Thanks for the idea though...
PS: For patches you may want to read the how to create patches handbook page
Comment #3
nicholasthompsonFixed in latest Dev.
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
doc2@drupalfr.org commentedMuch simpler solution to the issue, against the 5.x-1.0 version of the .module file,
a small bug to fix lies line 447:
$output .= theme('item_list', array(t('No items found.')), ucwords(t($type)), 'ul', array('class' => 'tqf_'. $type));replace it by:
$output .= theme('item_list', array(t('No items found.')), ucwords(t($types[$type])), 'ul', array('class' => 'tqf_'. $type));You're done!
Explanations:
It's been quite a while that I've been using it like this and it still works fine. I've attached the corrected version of the module for the lazy drupalers (still with the "ucwords()" PHP function, see below)!
Comment #6
doc2@drupalfr.org commentedOups, patch status, even if it's not a proper one... sorry for that.