Commit f7a6f396 authored by Dries's avatar Dries

Issue #1912946 by mitron: Clean up comments in comment.views.inc node.views.inc user.views.inc.

parent 11bcbce3
......@@ -11,8 +11,9 @@
* Implements hook_views_data().
*/
function comment_views_data() {
// Define the base group of this table. Fields that don't
// have a group defined will go into this field by default.
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['comment']['table']['group'] = t('Comment');
$data['comment']['table']['base'] = array(
......@@ -24,9 +25,6 @@ function comment_views_data() {
$data['comment']['table']['entity type'] = 'comment';
$data['comment']['table']['wizard_id'] = 'comment';
// Fields
// subject
$data['comment']['subject'] = array(
'title' => t('Title'),
'help' => t('The title of the comment.'),
......@@ -44,7 +42,6 @@ function comment_views_data() {
),
);
// cid
$data['comment']['cid'] = array(
'title' => t('ID'),
'help' => t('The comment ID of the field'),
......@@ -62,7 +59,6 @@ function comment_views_data() {
),
);
// name (of comment author)
$data['comment']['name'] = array(
'title' => t('Author'),
'help' => t("The name of the comment's author. Can be rendered as a link to the author's homepage."),
......@@ -80,7 +76,6 @@ function comment_views_data() {
),
);
// homepage
$data['comment']['homepage'] = array(
'title' => t("Author's website"),
'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."),
......@@ -98,7 +93,6 @@ function comment_views_data() {
),
);
// hostname
$data['comment']['hostname'] = array(
'title' => t('Hostname'),
'help' => t('Hostname of user that posted the comment.'),
......@@ -116,7 +110,6 @@ function comment_views_data() {
),
);
// mail
$data['comment']['mail'] = array(
'title' => t('E-mail'),
'help' => t('E-mail of user that posted the comment. Will be empty if the author is a registered user.'),
......@@ -134,7 +127,6 @@ function comment_views_data() {
),
);
// created (when comment was posted)
$data['comment']['created'] = array(
'title' => t('Post date'),
'help' => t('Date and time of when the comment was created.'),
......@@ -149,7 +141,6 @@ function comment_views_data() {
),
);
// Langcode field
if (module_exists('language')) {
$data['comment']['langcode'] = array(
'title' => t('Language'),
......@@ -169,7 +160,6 @@ function comment_views_data() {
);
}
// changed (when comment was last updated)
$data['comment']['changed'] = array(
'title' => t('Updated date'),
'help' => t('Date and time of when the comment was last updated.'),
......@@ -238,7 +228,6 @@ function comment_views_data() {
),
);
// status (approved or not)
$data['comment']['status'] = array(
'title' => t('Approved status'),
'help' => t('Whether the comment is approved (or still in the moderation queue).'),
......@@ -258,7 +247,6 @@ function comment_views_data() {
),
);
// Link to view comment.
$data['comment']['view_comment'] = array(
'field' => array(
'title' => t('Link to comment'),
......@@ -267,7 +255,6 @@ function comment_views_data() {
),
);
// Link to edit comment.
$data['comment']['edit_comment'] = array(
'field' => array(
'title' => t('Link to edit comment'),
......@@ -276,7 +263,6 @@ function comment_views_data() {
),
);
// Link to delete comment.
$data['comment']['delete_comment'] = array(
'field' => array(
'title' => t('Link to delete comment'),
......@@ -285,7 +271,6 @@ function comment_views_data() {
),
);
// Link to approve comment.
$data['comment']['approve_comment'] = array(
'field' => array(
'title' => t('Link to approve comment'),
......@@ -294,7 +279,6 @@ function comment_views_data() {
),
);
// Link to reply to comment.
$data['comment']['replyto_comment'] = array(
'field' => array(
'title' => t('Link to reply-to comment'),
......@@ -376,7 +360,6 @@ function comment_views_data() {
),
);
// Entity translation field.
if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) {
$data['comment']['translation_link'] = array(
'title' => t('Translation link'),
......@@ -387,14 +370,12 @@ function comment_views_data() {
);
}
// node_comment_statistics table
// define the group
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['node_comment_statistics']['table']['group'] = t('Content');
// joins
// Explain how this table joins to others.
$data['node_comment_statistics']['table']['join'] = array(
//...to the node table
'node' => array(
'type' => 'INNER',
'left_field' => 'nid',
......@@ -402,7 +383,6 @@ function comment_views_data() {
),
);
// last_comment_timestamp
$data['node_comment_statistics']['last_comment_timestamp'] = array(
'title' => t('Last comment time'),
'help' => t('Date and time of when the last comment was posted.'),
......@@ -417,7 +397,6 @@ function comment_views_data() {
),
);
// last_comment_name (author's name)
$data['node_comment_statistics']['last_comment_name'] = array(
'title' => t("Last comment author"),
'help' => t('The name of the author of the last posted comment.'),
......@@ -431,7 +410,6 @@ function comment_views_data() {
),
);
// comment_count
$data['node_comment_statistics']['comment_count'] = array(
'title' => t('Comment count'),
'help' => t('The number of comments a node has.'),
......@@ -449,7 +427,6 @@ function comment_views_data() {
),
);
// last_comment_timestamp
$data['node_comment_statistics']['last_updated'] = array(
'title' => t('Updated/commented date'),
'help' => t('The most recent of last comment posted or node updated time.'),
......@@ -480,7 +457,6 @@ function comment_views_data() {
),
);
// last_comment_uid
$data['node_comment_statistics']['last_comment_uid'] = array(
'title' => t('Last comment uid'),
'help' => t('The User ID of the author of the last comment of a node.'),
......@@ -506,8 +482,7 @@ function comment_views_data() {
}
/**
* Use views_data_alter to add items to the node table that are
* relevant to comments.
* Implements hook_views_data_alter().
*/
function comment_views_data_alter(&$data) {
// new comments
......@@ -528,7 +503,6 @@ function comment_views_data_alter(&$data) {
),
);
// Comment status of the node
$data['node']['comment'] = array(
'title' => t('Comment status'),
'help' => t('Whether comments are enabled or disabled on the node.'),
......
This diff is collapsed.
......@@ -11,10 +11,9 @@
* Implements hook_views_data().
*/
function user_views_data() {
// users table
// Define the base group of this table. Fields that don't
// have a group defined will go into this field by default.
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['users']['table']['group'] = t('User');
$data['users']['table']['base'] = array(
......@@ -26,16 +25,15 @@ function user_views_data() {
$data['users']['table']['entity type'] = 'user';
$data['users']['table']['wizard_id'] = 'user';
// uid
$data['users']['uid'] = array(
'title' => t('Uid'),
'help' => t('The user ID'), // The help that appears on the UI,
'help' => t('The user ID'),
'field' => array(
'id' => 'user',
),
'argument' => array(
'id' => 'user_uid',
'name field' => 'name', // display this field in the summary
'name field' => 'name',
),
'filter' => array(
'title' => t('Name'),
......@@ -55,7 +53,6 @@ function user_views_data() {
),
);
// uid_raw
$data['users']['uid_raw'] = array(
'help' => t('The raw numeric user ID.'),
'real field' => 'uid',
......@@ -65,7 +62,6 @@ function user_views_data() {
),
);
// uid
$data['users']['uid_representative'] = array(
'relationship' => array(
'title' => t('Representative node'),
......@@ -82,7 +78,6 @@ function user_views_data() {
),
);
// uid
$data['users']['uid_current'] = array(
'real field' => 'uid',
'title' => t('Current'),
......@@ -93,10 +88,9 @@ function user_views_data() {
),
);
// name
$data['users']['name'] = array(
'title' => t('Name'), // The item it appears as on the UI,
'help' => t('The user or author name.'), // The help that appears on the UI,
'title' => t('Name'),
'help' => t('The user or author name.'),
'field' => array(
'id' => 'user_name',
),
......@@ -113,7 +107,6 @@ function user_views_data() {
),
);
// mail
// Note that this field implements field level access control.
$data['users']['mail'] = array(
'title' => t('E-mail'),
......@@ -132,9 +125,8 @@ function user_views_data() {
),
);
// language
$data['users']['langcode'] = array(
'title' => t('Language'), // The item it appears as on the UI,
'title' => t('Language'),
'help' => t('Language of the user'),
'field' => array(
'id' => 'user_language',
......@@ -150,7 +142,6 @@ function user_views_data() {
),
);
// link
$data['users']['view_user'] = array(
'field' => array(
'title' => t('Link to user'),
......@@ -160,10 +151,9 @@ function user_views_data() {
),
);
// created field
$data['users']['created'] = array(
'title' => t('Created date'), // The item it appears as on the UI,
'help' => t('The date the user was created.'), // The help that appears on the UI,
'title' => t('Created date'),
'help' => t('The date the user was created.'),
'field' => array(
'id' => 'date',
),
......@@ -229,10 +219,9 @@ function user_views_data() {
),
);
// access field
$data['users']['access'] = array(
'title' => t('Last access'), // The item it appears as on the UI,
'help' => t("The user's last access date."), // The help that appears on the UI,
'title' => t('Last access'),
'help' => t("The user's last access date."),
'field' => array(
'id' => 'date',
),
......@@ -244,10 +233,9 @@ function user_views_data() {
),
);
// login field
$data['users']['login'] = array(
'title' => t('Last login'), // The item it appears as on the UI,
'help' => t("The user's last login date."), // The help that appears on the UI,
'title' => t('Last login'),
'help' => t("The user's last login date."),
'field' => array(
'id' => 'date',
),
......@@ -259,11 +247,9 @@ function user_views_data() {
),
);
// active status
$data['users']['status'] = array(
'title' => t('Active status'),
'help' => t('Whether a user is active or blocked.'), // The help that appears on the UI,
// Information for displaying a title as a field
'help' => t('Whether a user is active or blocked.'),
'field' => array(
'id' => 'boolean',
'output formats' => array(
......@@ -280,11 +266,9 @@ function user_views_data() {
),
);
// log field
$data['users']['signature'] = array(
'title' => t('Signature'), // The item it appears as on the UI,
'help' => t("The user's signature."), // The help that appears on the UI,
// Information for displaying a title as a field
'title' => t('Signature'),
'help' => t("The user's signature."),
'field' => array(
'id' => 'markup',
'format' => filter_fallback_format(),
......@@ -295,7 +279,6 @@ function user_views_data() {
),
);
// Entity translation field.
if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) {
$data['users']['translation_link'] = array(
'title' => t('Translation link'),
......@@ -333,13 +316,12 @@ function user_views_data() {
),
);
// users_roles table
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['users_roles']['table']['group'] = t('User');
// Explain how this table joins to others.
$data['users_roles']['table']['join'] = array(
// Directly links to users table.
'users' => array(
'left_field' => 'uid',
'field' => 'uid',
......@@ -367,10 +349,11 @@ function user_views_data() {
),
);
// permission table
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['role_permission']['table']['group'] = t('User');
// Explain how this table joins to others.
$data['role_permission']['table']['join'] = array(
// Directly links to users table.
'users' => array(
'left_table' => 'users_roles',
'left_field' => 'rid',
......@@ -394,7 +377,9 @@ function user_views_data() {
}
/**
* Allow replacement of current userid so we can cache these queries
* Implements hook_views_query_substitutions().
*
* Allow replacement of current userid so we can cache these queries.
*/
function user_views_query_substitutions($view) {
global $user;
......
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