Active
Project:
Link to content
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
25 Feb 2008 at 12:36 UTC
Updated:
19 Jun 2009 at 02:25 UTC
Actually, all vocabularies are shown in the first drop down list. Should be better to see only those assigned to selected content-types in the admin section.
To do this, in linktocontent_node.module, in the _linktocontent_node_get_categories function, replace :
foreach ($containers as $item) {
$obj = new StdClass;
$obj->vid = $item->vid;
$obj->tid = ($top ? $item->vid : $item->tid);
$obj->title = (trim($item->name));
$results[] = $obj;
} // end foreach
return $results;
by
$status = variable_get('linktocontent_node_content_types', array());
foreach ($containers as $item) {
$obj = new StdClass;
if (isVocabularyForContainer($item->nodes,$status)) {
$obj->vid = $item->vid;
$obj->tid = ($top ? $item->vid : $item->tid);
$obj->title = (trim($item->name));
$results[] = $obj;
}
} // end foreach
return $results;
and add the function as below :
function isVocabularyForContainer($container, $vocabularies) {
$nopresent = array_diff($vocabularies, $container);
return (! (count($nopresent) == count($vocabularies)));
}
Is this feature could be include in the next patch ?
Comments
Comment #1
stborchertHi Marc.
Thanks for your feedback.
I hope to be able to create a new version (5.2.x) within the next weeks (or finally start with coding on it).
This feature will be in it definitely.
thanks again,
Stefan
Comment #2
stborchertmoved task to new development version
Comment #3
webrascal commentedThe suggestion works great but needs a tweak.
In the loop of the 'containers' it assumes it's always dealing with a vocabulary and not the final terms.
This means when you're at the lowest level (terms) you're testing in isVocabularyForContainer returns errors as terms node does not have a nodes attribute.
I recommend this solution: