class revisioning_handler_field_node_state in Revisioning 6.3
Same name and namespace in other branches
- 8 views/revisioning_handler_field_node_state.inc \revisioning_handler_field_node_state
- 6.4 views/revisioning_handler_field_node_state.inc \revisioning_handler_field_node_state
- 7 views/revisioning_handler_field_node_state.inc \revisioning_handler_field_node_state
@file Handler for the 'Node: state' field.
Hierarchy
- class \revisioning_handler_field_node_state extends \views_handler_field
Expanded class hierarchy of revisioning_handler_field_node_state
1 string reference to 'revisioning_handler_field_node_state'
- revisioning_views_data_alter in views/
revisioning.views.inc - Implementation of hook_views_data_alter().
File
- views/
revisioning_handler_field_node_state.inc, line 7 - Handler for the 'Node: state' field.
View source
class revisioning_handler_field_node_state extends views_handler_field {
function construct() {
parent::construct();
// Request node fields required to calculate the 'state' when rendering
$this->additional_fields['nid'] = 'nid';
$this->additional_fields['vid'] = 'vid';
$this->additional_fields['published'] = array(
'field' => 'status',
);
}
function access() {
return user_access('access content');
}
function query() {
// Not calling parent::query() as it will treat 'state' as a real db field.
$this
->ensure_my_table();
$this
->add_additional_fields();
}
/**
* Implement the rendering of the state value.
*
* Note that $values contains:
* o nid
* o node_vid (current revision id)
* o node_status (published flag)
*/
function render($values) {
$published = $values->{$this->aliases['published']};
$nid = $values->{$this->aliases['nid']};
$current_vid = $values->{$this->aliases['vid']};
$is_initial_unpublished_draft = !$published && node_tools_get_number_of_revisions($nid) == 1;
$latest_vid = revisioning_get_latest_revision_id($nid);
$is_pending = $latest_vid > $current_vid || $is_initial_unpublished_draft;
$description = $is_pending ? !$published && !$is_initial_unpublished_draft ? t('Archived with revision pending') : t('Revision pending') : ($published && $latest_vid == $current_vid ? t('Current, published') : t('Archived'));
return $description;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
revisioning_handler_field_node_state:: |
function | |||
revisioning_handler_field_node_state:: |
function | |||
revisioning_handler_field_node_state:: |
function | |||
revisioning_handler_field_node_state:: |
function | Implement the rendering of the state value. |