Commit b3f18a65 authored by catch's avatar catch

Issue #1891036 by damiankloip: Make 'click sortable' default to TRUE.

parent 4e61e4c9
......@@ -32,7 +32,6 @@ function comment_views_data() {
'help' => t('The title of the comment.'),
'field' => array(
'id' => 'comment',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -51,7 +50,6 @@ function comment_views_data() {
'help' => t('The comment ID of the field'),
'field' => array(
'id' => 'comment',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'numeric',
......@@ -70,7 +68,6 @@ function comment_views_data() {
'help' => t("The name of the comment's author. Can be rendered as a link to the author's homepage."),
'field' => array(
'id' => 'comment_username',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -89,7 +86,6 @@ function comment_views_data() {
'help' => t("The website address of the comment's author. Can be rendered as a link. Will be empty if the author is a registered user."),
'field' => array(
'id' => 'url',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -108,7 +104,6 @@ function comment_views_data() {
'help' => t('Hostname of user that posted the comment.'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -127,7 +122,6 @@ function comment_views_data() {
'help' => t('Email of user that posted the comment. Will be empty if the author is a registered user.'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -146,7 +140,6 @@ function comment_views_data() {
'help' => t('Date and time of when the comment was created.'),
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date',
......@@ -163,7 +156,6 @@ function comment_views_data() {
'help' => t('The language the comment is in.'),
'field' => array(
'id' => 'language',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'language',
......@@ -183,7 +175,6 @@ function comment_views_data() {
'help' => t('Date and time of when the comment was last updated.'),
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date',
......@@ -253,7 +244,6 @@ function comment_views_data() {
'help' => t('Whether the comment is approved (or still in the moderation queue).'),
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'approved-not-approved' => array(t('Approved'), t('Not Approved')),
),
......@@ -407,7 +397,6 @@ function comment_views_data() {
'help' => t('Date and time of when the last comment was posted.'),
'field' => array(
'id' => 'comment_last_timestamp',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date',
......@@ -423,7 +412,6 @@ function comment_views_data() {
'help' => t('The name of the author of the last posted comment.'),
'field' => array(
'id' => 'comment_ncs_last_comment_name',
'click sortable' => TRUE,
'no group by' => TRUE,
),
'sort' => array(
......@@ -438,7 +426,6 @@ function comment_views_data() {
'help' => t('The number of comments a node has.'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'numeric',
......@@ -457,7 +444,6 @@ function comment_views_data() {
'help' => t('The most recent of last comment posted or node updated time.'),
'field' => array(
'id' => 'comment_ncs_last_updated',
'click sortable' => TRUE,
'no group by' => TRUE,
),
'sort' => array(
......@@ -537,7 +523,6 @@ function comment_views_data_alter(&$data) {
'help' => t('Whether comments are enabled or disabled on the node.'),
'field' => array(
'id' => 'node_comment',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......
......@@ -242,7 +242,6 @@ function field_views_field_default_views_data($field) {
$data[$table][$column]['field'] = array(
'table' => $table,
'id' => 'field',
'click sortable' => TRUE,
'field_name' => $field['field_name'],
// Provide a real field for group by.
'real field' => $column . '_' . $real_field,
......
......@@ -35,7 +35,6 @@ function file_views_data() {
'help' => t('The ID of the file.'),
'field' => array(
'id' => 'file',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'file_fid',
......@@ -56,7 +55,6 @@ function file_views_data() {
'help' => t('The name of the file.'),
'field' => array(
'id' => 'file',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -75,7 +73,6 @@ function file_views_data() {
'help' => t('The path of the file.'),
'field' => array(
'id' => 'file_uri',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -94,7 +91,6 @@ function file_views_data() {
'help' => t('The mime type of the file.'),
'field' => array(
'id' => 'file_filemime',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -124,7 +120,6 @@ function file_views_data() {
'help' => t('The size of the file.'),
'field' => array(
'id' => 'file_size',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -140,7 +135,6 @@ function file_views_data() {
'help' => t('The status of the file.'),
'field' => array(
'id' => 'file_status',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -156,7 +150,6 @@ function file_views_data() {
'help' => t('The date the file was uploaded.'),
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -390,7 +383,6 @@ function file_views_data() {
'help' => t('The module managing this file relationship.'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -407,7 +399,6 @@ function file_views_data() {
'help' => t('The type of entity that is related to the file.'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -424,7 +415,6 @@ function file_views_data() {
'help' => t('The ID of the entity that is related to the file.'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'numeric',
......@@ -441,7 +431,6 @@ function file_views_data() {
'help' => t('The number of times the file is used by this entity.'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'numeric',
......
......@@ -42,7 +42,6 @@ function node_views_data() {
// Information for displaying the nid
'field' => array(
'id' => 'node',
'click sortable' => TRUE,
),
// Information for accepting a nid as an argument
'argument' => array(
......@@ -71,7 +70,6 @@ function node_views_data() {
'field' => 'title', // the real field. This could be left out since it is the same.
'group' => t('Content'), // The group it appears in on the UI. Could be left out.
'id' => 'node',
'click sortable' => TRUE,
'link_to_node default' => TRUE,
),
'sort' => array(
......@@ -92,7 +90,6 @@ function node_views_data() {
'help' => t('The date the content was posted.'), // The help that appears on the UI,
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -108,7 +105,6 @@ function node_views_data() {
'help' => t('The date the content was last updated.'), // The help that appears on the UI,
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -124,7 +120,6 @@ function node_views_data() {
'help' => t('The content type (for example, "blog entry", "forum post", "story", etc).'), // The help that appears on the UI,
'field' => array(
'id' => 'node_type',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -143,7 +138,6 @@ function node_views_data() {
'help' => t('Whether or not the content is published.'),
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'published-notpublished' => array(t('Published'), t('Not published')),
),
......@@ -176,7 +170,6 @@ function node_views_data() {
'help' => t('Whether or not the content is promoted to the front page.'),
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'promoted-notpromoted' => array(t('Promoted'), t('Not promoted')),
),
......@@ -198,7 +191,6 @@ function node_views_data() {
// Information for displaying a title as a field
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'sticky' => array(t('Sticky'), t('Not sticky')),
),
......@@ -221,7 +213,6 @@ function node_views_data() {
'help' => t('The language the content is in.'),
'field' => array(
'id' => 'node_language',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'language',
......@@ -466,12 +457,10 @@ function node_views_data() {
// Information for displaying the nid.
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
// Information for accepting a nid as an argument.
'argument' => array(
'id' => 'node_nid',
'click sortable' => TRUE,
'numeric' => TRUE,
),
// Information for accepting a nid as a filter.
......@@ -498,12 +487,10 @@ function node_views_data() {
// Information for displaying the vid
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
// Information for accepting a vid as an argument
'argument' => array(
'id' => 'node_vid',
'click sortable' => TRUE,
'numeric' => TRUE,
),
// Information for accepting a vid as a filter
......@@ -529,7 +516,6 @@ function node_views_data() {
'help' => t('Whether or not the content is published.'),
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'published-notpublished' => array(t('Published'), t('Not published')),
),
......@@ -553,7 +539,6 @@ function node_views_data() {
'field' => array(
'field' => 'title', // the real field
'id' => 'node_revision',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -586,7 +571,6 @@ function node_views_data() {
'help' => t('The date the node was last updated.'), // The help that appears on the UI,
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -601,6 +585,7 @@ function node_views_data() {
'title' => t('Link'),
'help' => t('Provide a simple link to the revision.'),
'id' => 'node_revision_link',
'click sortable' => FALSE,
),
);
......@@ -609,6 +594,7 @@ function node_views_data() {
'title' => t('Revert link'),
'help' => t('Provide a simple link to revert to the revision.'),
'id' => 'node_revision_link_revert',
'click sortable' => FALSE,
),
);
......@@ -617,6 +603,7 @@ function node_views_data() {
'title' => t('Delete link'),
'help' => t('Provide a simple link to delete the content revision.'),
'id' => 'node_revision_link_delete',
'click sortable' => FALSE,
),
);
......
......@@ -45,6 +45,7 @@ function entity_test_views_data() {
),
'field' => array(
'id' => 'standard',
'click sortable' => FALSE,
),
'filter' => array(
'id' => 'string',
......@@ -60,7 +61,6 @@ function entity_test_views_data() {
'help' => t('The {language}.langcode of the original variant of this test entity.'),
'field' => array(
'id' => 'language',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'language',
......@@ -102,7 +102,6 @@ function entity_test_views_data() {
'help' => t('The {language}.langcode of this variant of this test entity.'),
'field' => array(
'id' => 'language',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'language',
......@@ -119,7 +118,6 @@ function entity_test_views_data() {
'help' => t('Boolean indicating whether the current variant is in the original entity language.'),
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'boolean',
......@@ -138,7 +136,6 @@ function entity_test_views_data() {
'help' => t('The name of the test entity.'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'string',
......@@ -156,7 +153,6 @@ function entity_test_views_data() {
'help' => t('The name of the test entity.'),
'field' => array(
'id' => 'user',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'user_name',
......
......@@ -41,7 +41,6 @@ function taxonomy_views_data() {
'help' => t('The tid of a taxonomy term.'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -93,7 +92,6 @@ function taxonomy_views_data() {
'help' => t('The taxonomy term name.'),
'field' => array(
'id' => 'taxonomy',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -116,7 +114,6 @@ function taxonomy_views_data() {
'help' => t('The term weight field'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -136,6 +133,7 @@ function taxonomy_views_data() {
'field' => array(
'id' => 'markup',
'format' => array('field' => 'format'),
'click sortable' => FALSE,
),
'filter' => array(
'id' => 'string',
......@@ -156,7 +154,6 @@ function taxonomy_views_data() {
'help' => t('Language of the term'),
'field' => array(
'id' => 'taxonomy_term_language',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -175,6 +172,7 @@ function taxonomy_views_data() {
'title' => t('Term edit link'),
'help' => t('Provide a simple link to edit the term.'),
'id' => 'term_link_edit',
'click sortable' => FALSE,
),
);
......@@ -291,6 +289,7 @@ function taxonomy_views_data_alter(&$data) {
'help' => t('Display all taxonomy terms associated with a node from specified vocabularies.'),
'id' => 'taxonomy_index_tid',
'no group by' => TRUE,
'click sortable' => FALSE,
),
);
......
......@@ -32,7 +32,6 @@ function user_views_data() {
'help' => t('The user ID'), // The help that appears on the UI,
'field' => array(
'id' => 'user',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'user_uid',
......@@ -100,7 +99,6 @@ function user_views_data() {
'help' => t('The user or author name.'), // The help that appears on the UI,
'field' => array(
'id' => 'user_name',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -122,7 +120,6 @@ function user_views_data() {
'help' => t('Email address for a given user. This field is normally not shown to users, so be cautious when using it.'), // The help that appears on the UI,
'field' => array(
'id' => 'user_mail',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -141,7 +138,6 @@ function user_views_data() {
'help' => t('Language of the user'),
'field' => array(
'id' => 'user_language',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
......@@ -160,6 +156,7 @@ function user_views_data() {
'title' => t('Link'),
'help' => t('Provide a simple link to the user.'),
'id' => 'user_link',
'click sortable' => FALSE,
),
);
......@@ -169,7 +166,6 @@ function user_views_data() {
'help' => t('The date the user was created.'), // The help that appears on the UI,
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -239,7 +235,6 @@ function user_views_data() {
'help' => t("The user's last access date."), // The help that appears on the UI,
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -255,7 +250,6 @@ function user_views_data() {
'help' => t("The user's last login date."), // The help that appears on the UI,
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date'
......@@ -272,7 +266,6 @@ function user_views_data() {
// Information for displaying a title as a field
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'active-blocked' => array(t('Active'), t('Blocked')),
),
......@@ -295,6 +288,7 @@ function user_views_data() {
'field' => array(
'id' => 'markup',
'format' => filter_fallback_format(),
'click sortable' => FALSE,
),
'filter' => array(
'id' => 'string',
......@@ -306,6 +300,7 @@ function user_views_data() {
'title' => t('Edit link'),
'help' => t('Provide a simple link to edit the user.'),
'id' => 'user_link_edit',
'click sortable' => FALSE,
),
);
......@@ -314,6 +309,7 @@ function user_views_data() {
'title' => t('Cancel link'),
'help' => t('Provide a simple link to cancel the user.'),
'id' => 'user_link_cancel',
'click sortable' => FALSE,
),
);
......
......@@ -177,9 +177,13 @@ function click_sort($order) {
/**
* Determine if this field is click sortable.
*
* @return bool
* The value of 'click sortable' from the plugin definition, this defaults
* to TRUE if not set.
*/
function click_sortable() {
return !empty($this->definition['click sortable']);
return isset($this->definition['click sortable']) ? $this->definition['click sortable'] : TRUE;
}
/**
......
......@@ -47,6 +47,8 @@ protected function setUp() {
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['job']['field']['id'] = 'test_field';
$data['views_test_data']['job']['field']['click sortable'] = FALSE;
$data['views_test_data']['id']['field']['click sortable'] = TRUE;
return $data;
}
......@@ -514,4 +516,21 @@ function testIsValueEmpty() {
$this->assertTrue($field->is_value_empty(NULL, TRUE, FALSE), 'Null should be always seen as empty, regardless of no_skip_empty.');
}
/**
* Tests whether the filters are click sortable as expected.
*/
public function testClickSortable() {
// Test that click_sortable is TRUE by default.
$plugin = views_get_handler('views_test_data', 'name', 'field');
$this->assertTrue($plugin->click_sortable(), 'TRUE as a default value is correct.');
// Test that click_sortable is TRUE by when set TRUE in the data.
$plugin = views_get_handler('views_test_data', 'id', 'field');
$this->assertTrue($plugin->click_sortable(), 'TRUE as a views data value is correct.');
// Test that click_sortable is FALSE by when set FALSE in the data.
$plugin = views_get_handler('views_test_data', 'job', 'field');
$this->assertFalse($plugin->click_sortable(), 'FALSE as a views data value is correct.');
}
}
......@@ -137,7 +137,6 @@ public static function viewsData() {
'help' => t('The test data ID'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'numeric',
......@@ -154,7 +153,6 @@ public static function viewsData() {
'help' => t('The name of the person'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'string',
......@@ -171,7 +169,6 @@ public static function viewsData() {
'help' => t('The age of the person'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'numeric',
......@@ -188,7 +185,6 @@ public static function viewsData() {
'help' => t('The job of the person'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'string',
......@@ -205,7 +201,6 @@ public static function viewsData() {
'help' => t('The creation date of this record'),
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'argument' => array(
'id' => 'date',
......
......@@ -191,7 +191,6 @@ function hook_views_data() {
'help' => t('Just a plain text field.'),
'field' => array(
'id' => 'standard',
'click sortable' => TRUE, // This is use by the table display plugin.
),
'sort' => array(
'id' => 'standard',
......@@ -210,7 +209,6 @@ function hook_views_data() {
'help' => t('Just a numeric field.'),
'field' => array(
'id' => 'numeric',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'numeric',
......@@ -226,7 +224,6 @@ function hook_views_data() {
'help' => t('Just an on/off field.'),
'field' => array(
'id' => 'boolean',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'boolean',
......@@ -248,7 +245,6 @@ function hook_views_data() {
'help' => t('Just a timestamp field.'),
'field' => array(
'id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'date',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment