views_handler_field_node_type.inc in Views (for Drupal 7) 6.2
File
modules/node/views_handler_field_node_type.inc
View source
<?php
class views_handler_field_node_type extends views_handler_field_node {
function option_definition() {
$options = parent::option_definition();
$options['machine_name'] = array(
'default' => FALSE,
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['machine_name'] = array(
'#title' => t('Output machine name'),
'#description' => t('Display field as the node type machine name.'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['machine_name']),
);
}
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);
}
function render($values) {
return $this
->render_link($this
->render_name($values->{$this->field_alias}, $values), $values);
}
}