The views_handler_field_node_type class in views_handler_field_node_type.inc has the following render() function:
function render_name($data, $values) {
if ($this->options['machine_name'] != 1 && $data !== NULL && $data !== '') {
return t(check_plain(node_get_types('name', $data)));
}
return check_plain($data);
}
In this case, $data is the machine name of the node type, which may only be characters and underscores.
My use-case:
I'd like to theme the node type as an icon (with a link to the node types primary pages, etc.), and used a custom theme template and a hook_views_pre_render(&$view) override to achieve this (nicely!). But all my good theming work gets escaped by the check_plain() call.
Perhaps I'm going about this the wrong way, in which case, I guess this is a support request: What is the best way to theme a node type views field to provide an iconic representation?
There are a few suggestions for particular use-cases:
* http://drupal.org/node/140517
* http://drupal.org/node/406188
but I can't find anything flexible enough to allow me to do what I want (other than hacking views to remove the check_plain()!!)
Comments
Comment #1
dawehnerYou could use a field tpl.php There you can print out the image.
Alternative you can use the "rewrite output of this field" feature and add the img tag there. You can use [type] as token to provide a class/image path. That's what you need here.
Comment #2
jfall commentedThanks Dereine!
rewrite output was my first guess, but doesn't offer enough flexibility - I need a few conditionals, but I'll try using the field template.
Comment #3
dawehnerSo this is fixed.
Comment #4
jfall commentedOops - sorry I didn't intentionally set status back to active...
For any others who stumble on this thread, I ended up adding this theme override to my template.php:
Many thanks again dereine - you've opened my eyes to a whole new set of views theming possibilities!