Posted by BWPanda on June 11, 2009 at 11:37pm
| Project: | Chaos tool suite (ctools) |
| Version: | 6.x-1.x-dev |
| Component: | Plugins system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | dww |
| Status: | closed (fixed) |
Issue Summary
I've setup a panel that overrides one of my content type node views. I'm now trying to display all node fields in the panel, but am having trouble getting assigned taxonomy terms to display...
I've tried using a 'term from node' relationship, but that only allows me to display 'related terms' or the 'term description'. I also tried using a 'taxonomy vocabulary' context, but that displays all terms, not just the ones assigned to each node. Finally, I looked at using the 'taxonomy term' context, but it wants me to select a specific term, which seems to defeat the purpose...
Is this possible yet in this version of panels, and if so, what am I missing?
Comments
#1
Found an old issue I had previously submitted, marked as duplicate of this one (#396880: List node's taxonomy terms).
#2
I think custom CTools content needs to be implemented for this to work. You can contribute to community working this out, I believe this is very common needed feature.
In case you gonna do it, implement vocabulary selector also, such as:
Display terms from vocabulary: all, $vocab1, $vocab2, $vocab3, ... etc (multiple checkboxes)
This will be very useful
#3
I had the same problem.
I decided to use : http://drupal.org/project/content_taxonomy
Thanks to this module, Taxonomy fields become CCK fields. Then the integration with Panel is made simple.
Hope it can help...
#4
I need this too but I don't know much of programming to help. Did anyone found another way that doesn't need another module to be installed?
#5
You can use a view:
<?php$view = new view;
$view->name = 'terms_for_node';
$view->description = 'List the terms for a node';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'tid' => array(
'label' => 'All terms',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'separator',
'separator' => ', ',
'link_to_taxonomy' => 1,
'limit' => 0,
'vids' => array(
'2' => 0,
'3' => 0,
'1' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'nid' => array(
'default_action' => 'not found',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'3' => 0,
'4' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'blog' => 0,
'poll' => 0,
'panel' => 0,
'article' => 0,
'character' => 0,
'page' => 0,
'skill' => 0,
'story' => 0,
'type_a' => 0,
'type_b' => 0,
'type_c' => 0,
'uprofile' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'2' => 0,
'3' => 0,
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
?>
There's lots of tweaking you can do there to control how the terms are displayed, what vocabularies to show, etc.
#6
#7
Automatically closed -- issue fixed for 2 weeks with no activity.
#8
Thanks for the View.
The first tweaking I needed, was to list terms by vocabulary like this :
"Name Vocalbulary 1" : Term1, Term 2...
"Name Vocabulary 2" : Term 3, Term4...
For this I ve added several times the same field "Taxonomy term" and restrict the terms listed to each vocabulary.
And it works fine.
Could be interesting to share some ways to tweak this views "terms for node".
For example, when I have time, I think I will try to use this plugin for views also :http://drupal.org/project/views_cloud
#9
subscribe
#10
Doing this via a view is a bit overkill. sdboyer said he's accept a patch to just add a ctools content_type plugin to provide this from a node context, along with the other fields and such that are already provided. So, here it is. ;)
(Not sure if I should move this issue to the ctools issue queue or not, but the patch is against ctools).
#11
When I was talking this through with sdboyer, I suggested we might want another formatting choice for the equivalent of:
$terms = taxonomy_link('taxonomy terms', $node);print theme('links', $terms);
So, I added that and made all the relevant changes. The specific UI text could maybe be tightened up a bit (see attached png, which shows all possible settings by selecting inline-delimited), but I think this is basically RTBC now. I certainly tested all the cases thoroughly and the plumbing works as intended.
#12
Yep, I prefer these in the ctools queue, so moving it there.
Committed, thanks!
#13
Yay, thanks! Glad to implement something I needed The Right Way(tm) and be able to share it. ;)
#14
Automatically closed -- issue fixed for 2 weeks with no activity.