--- C:\Documents and Settings\Andy.LIVELINK\Desktop\views_node.inc +++ C:\Documents and Settings\Andy.LIVELINK\Desktop\views_node 2.inc @@ -35,6 +35,13 @@ 'sort_handler' => 'views_node_query_handler_nid', 'help' => t('Display the NID of a node.'), ), + 'status' => array( + 'name' => t('Node: Published'), + 'handler' => 'views_handler_field_yesno', + 'sortable' => true, + 'notafield' => false, + 'help' => t('Display whether this node is published (Yes) or unpublished (No).'), + ), 'created' => array( 'name' => t('Node: Created Time'), 'sortable' => true, @@ -405,6 +412,16 @@ return l($value, "node/$data->nid"); } +/** + * Convert the 1/0 value to Yes or No, respectively. + */ +function views_handler_field_yesno($fieldinfo, $fielddata, $value, $data) { + switch(check_plain($value)) { + case 0: return t('No'); + case 1: return t('Yes'); + } +} + /* * Not to be confused with views_handler_field_nodelink above. This formats * the option field as a link to the node. @@ -925,3 +942,4 @@ function views_handler_node_nid($fieldinfo, $fielddata, $value, $data) { return $data->nid; } +