Commit 4b812ec9 authored by catch's avatar catch

Issue #2342045 by dawehner, Gábor Hojtsy, larowlan, joshtaylor: Standard views...

Issue #2342045 by dawehner, Gábor Hojtsy, larowlan, joshtaylor: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency
parent 8cf2ca01
......@@ -241,6 +241,19 @@ field.formatter.settings.boolean:
type: string
label: 'Custom output for TRUE'
field.formatter.settings.boolean:
type: mapping
mapping:
format:
type: string
label: 'Output format'
format_custom_false:
type: string
label: 'Custom output for FALSE'
format_custom_true:
type: string
label: 'Custom output for TRUE'
field.formatter.settings.string:
type: mapping
mapping:
......
......@@ -25,6 +25,7 @@
* label = @Translation("Plain text"),
* field_types = {
* "string",
* "uri",
* },
* quickedit = {
* "editor" = "plain_text"
......
......@@ -77,8 +77,7 @@ display:
html: false
hide_empty: false
empty_zero: false
link_to_node: true
plugin_id: node
plugin_id: field
entity_type: node
entity_field: title
node_bulk_form:
......
......@@ -78,7 +78,7 @@ display:
admin_label: ''
label: 'Item ID'
exclude: false
plugin_id: numeric
plugin_id: field
alter:
alter_text: false
text: ''
......@@ -118,15 +118,7 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
set_precision: false
precision: 0
decimal: .
separator: ','
format_plural: false
format_plural_singular: '1'
format_plural_plural: '@count'
prefix: ''
suffix: ''
type: number_integer
entity_type: aggregator_item
entity_field: iid
filters: { }
......
......@@ -77,7 +77,8 @@ display:
table: aggregator_feed
field: fid
id: fid
plugin_id: numeric
plugin_id: field
type: number_integer
relationship: none
group_type: group
admin_label: ''
......@@ -122,15 +123,6 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
set_precision: false
precision: 0
decimal: .
separator: ','
format_plural: false
format_plural_singular: '1'
format_plural_plural: '@count'
prefix: ''
suffix: ''
entity_type: aggregator_feed
entity_field: fid
filters: { }
......
......@@ -37,7 +37,7 @@ display:
table: aggregator_item
field: iid
id: iid
plugin_id: numeric
plugin_id: field
entity_type: aggregator_item
entity_field: iid
title:
......
......@@ -59,7 +59,7 @@ public function testBlockContentRevisionRelationship() {
$block_content_revision->save();
$column_map = array(
'revision_id' => 'revision_id',
'block_content_revision_id' => 'block_content_revision_id',
'id_1' => 'id_1',
'block_content_block_content_revision_id' => 'block_content_block_content_revision_id',
);
......@@ -69,12 +69,12 @@ public function testBlockContentRevisionRelationship() {
$resultset_id = array(
array(
'revision_id' => '1',
'block_content_revision_id' => '1',
'id_1' => '1',
'block_content_block_content_revision_id' => '1',
),
array(
'revision_id' => '2',
'block_content_revision_id' => '1',
'id_1' => '1',
'block_content_block_content_revision_id' => '1',
),
);
......@@ -86,7 +86,7 @@ public function testBlockContentRevisionRelationship() {
$resultset_revision_id = array(
array(
'revision_id' => '2',
'block_content_revision_id' => '1',
'id_1' => '1',
'block_content_block_content_revision_id' => '1',
),
);
......
......@@ -26,14 +26,14 @@ display:
id: revision_id
table: block_content_revision
field: revision_id
plugin_id: numeric
plugin_id: field
entity_type: block_content
entity_field: revision_id
id_1:
id: id_1
table: block_content_revision
field: id
plugin_id: standard
plugin_id: field
entity_type: block_content
entity_field: id
id:
......
......@@ -28,14 +28,14 @@ display:
id: revision_id
table: block_content_revision
field: revision_id
plugin_id: standard
plugin_id: field
entity_type: block_content
entity_field: revision_id
id_1:
id: id_1
table: block_content_revision
field: id
plugin_id: standard
plugin_id: field
entity_type: block_content
entity_field: id
id:
......
......@@ -102,9 +102,6 @@ public function getViewsData() {
$data['comment_field_data']['status']['title'] = t('Approved status');
$data['comment_field_data']['status']['help'] = t('Whether the comment is approved (or still in the moderation queue).');
$data['comment_field_data']['status']['field']['output formats'] = array(
'approved-not-approved' => array(t('Approved'), t('Not Approved')),
);
$data['comment_field_data']['status']['filter']['label'] = t('Approved comment status');
$data['comment_field_data']['status']['filter']['type'] = 'yes-no';
......
......@@ -84,8 +84,7 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
link_to_node: true
plugin_id: node
plugin_id: field
entity_type: node
entity_field: title
filters:
......
......@@ -23,7 +23,7 @@ display:
id: id
relationship: none
table: entity_test
plugin_id: numeric
plugin_id: field
entity_type: entity_test
entity_field: id
id_1:
......@@ -31,7 +31,7 @@ display:
id: id_1
relationship: test_relationship
table: entity_test
plugin_id: numeric
plugin_id: field
entity_type: entity_test
entity_field: id
pager:
......
......@@ -16,53 +16,6 @@ views.argument.field_list_string:
type: boolean
label: 'Display list value as human readable'
views.field.field:
type: views_field
label: 'Views entity field handler'
mapping:
click_sort_column:
type: string
label: 'Column used for click sorting'
type:
type: string
label: 'Formatter'
settings:
label: 'Settings'
type: field.formatter.settings.[%parent.type]
group_column:
type: string
label: 'Group by column'
group_columns:
type: sequence
label: 'Group by columns'
sequence:
type: string
label: 'Column'
group_rows:
type: boolean
label: 'Display all values in the same row'
delta_limit:
type: integer
label: 'Field'
delta_offset:
type: integer
label: 'Offset'
delta_reversed:
type: boolean
label: 'Reversed'
delta_first_last:
type: boolean
label: 'First and last only'
multi_type:
type: string
label: 'Display type'
separator:
type: label
label: 'Separator'
field_api_classes:
type: boolean
label: 'Use field template'
views.filter.field_list:
type: views.filter.many_to_one
label: 'List field'
......
......@@ -22,7 +22,7 @@ display:
field: nid
id: nid
table: node
plugin_id: node
plugin_id: field
entity_type: node
entity_field: nid
field_name_0:
......
......@@ -168,10 +168,12 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
link_to_node: true
plugin_id: node
entity_type: node
entity_field: title
type: string
settings:
link_to_entity: true
plugin_id: field
type:
id: type
table: node_field_data
......@@ -227,11 +229,12 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
type: published-notpublished
type_custom_true: ''
type_custom_false: ''
not: false
plugin_id: boolean
type: boolean
settings:
format: custom
format_custom_true: 'Published'
format_custom_false: 'Unpublished'
plugin_id: field
entity_type: node
entity_field: status
changed:
......
......@@ -118,8 +118,6 @@ display:
html: false
hide_empty: false
empty_zero: false
link_to_node: true
plugin_id: node
relationship: none
group_type: group
admin_label: ''
......@@ -133,6 +131,12 @@ display:
element_default_classes: true
empty: ''
hide_alter_empty: true
type: string
settings:
link_to_entity: true
plugin_id: field
entity_type: node
entity_field: title
name:
id: name
table: users_field_data
......
......@@ -68,8 +68,7 @@ display:
id: title
table: node_field_data
field: title
link_to_node: true
plugin_id: node
plugin_id: field
relationship: none
group_type: group
admin_label: ''
......
......@@ -24,7 +24,6 @@ public function getViewsData() {
$data['node_field_data']['table']['base']['access query tag'] = 'node_access';
$data['node_field_data']['table']['wizard_id'] = 'node';
$data['node_field_data']['nid']['field']['id'] = 'node';
$data['node_field_data']['nid']['field']['argument'] = [
'id' => 'node_nid',
'name field' => 'title',
......@@ -32,7 +31,8 @@ public function getViewsData() {
'validate type' => 'nid',
];
$data['node_field_data']['title']['field']['id'] = 'node';
$data['node_field_data']['title']['field']['default_formatter_settings'] = ['link_to_entity' => TRUE];
$data['node_field_data']['title']['field']['link_to_node default'] = TRUE;
$data['node_field_data']['type']['field']['id'] = 'node_type';
......@@ -40,9 +40,6 @@ public function getViewsData() {
$data['node_field_data']['langcode']['help'] = t('The language of the content or translation.');
$data['node_field_data']['status']['field']['output formats'] = [
'published-notpublished' => array(t('Published'), t('Not published')),
];
$data['node_field_data']['status']['filter']['label'] = t('Published status');
$data['node_field_data']['status']['filter']['type'] = 'yes-no';
// Use status = 1 instead of status <> 0 in WHERE statement.
......@@ -58,15 +55,9 @@ public function getViewsData() {
),
);
$data['node_field_data']['promote']['field']['output formats'] = [
'promoted-notpromoted' => array(t('Promoted'), t('Not promoted')),
];
$data['node_field_data']['promote']['filter']['label'] = t('Promoted to front page status');
$data['node_field_data']['promote']['filter']['type'] = 'yes-no';
$data['node_field_data']['sticky']['field']['output formats'] = [
'sticky' => array(t('Sticky'), t('Not sticky')),
];
$data['node_field_data']['sticky']['filter']['label'] = t('Sticky status');
$data['node_field_data']['sticky']['filter']['type'] = 'yes-no';
$data['node_field_data']['sticky']['sort']['help'] = t('Whether or not the content is sticky. To list sticky content first, set this to descending.');
......@@ -299,9 +290,6 @@ public function getViewsData() {
$data['node_field_revision']['table']['join']['node_field_data']['left_field'] = 'vid';
$data['node_field_revision']['table']['join']['node_field_data']['field'] = 'vid';
$data['node_field_revision']['status']['field']['output formats'] = [
'published-notpublished' => [t('Published'), t('Not published')],
];
$data['node_field_revision']['status']['filter']['label'] = t('Published');
$data['node_field_revision']['status']['filter']['type'] = 'yes-no';
$data['node_field_revision']['status']['filter']['use_equal'] = TRUE;
......
......@@ -36,7 +36,7 @@ public function query() {
public function getCacheContexts() {
$contexts = parent::getCacheContexts();
$contexts[] = 'cache.context.user';
$contexts[] = 'user';
return $contexts;
}
......
......@@ -102,8 +102,8 @@ protected function defaultDisplayOptions() {
$display_options['fields']['title']['alter']['html'] = 0;
$display_options['fields']['title']['hide_empty'] = 0;
$display_options['fields']['title']['empty_zero'] = 0;
$display_options['fields']['title']['link_to_node'] = 1;
$display_options['fields']['title']['plugin_id'] = 'node';
$display_options['fields']['title']['settings']['link_to_entity'] = 1;
$display_options['fields']['title']['plugin_id'] = 'field';
return $display_options;
}
......@@ -184,8 +184,8 @@ protected function display_options_row(&$display_options, $row_plugin, $row_opt
$display_options['fields']['title']['id'] = 'title';
$display_options['fields']['title']['table'] = 'node_field_data';
$display_options['fields']['title']['field'] = 'title';
$display_options['fields']['title']['link_to_node'] = ($row_plugin == 'titles_linked');
$display_options['fields']['title']['plugin_id'] = 'node';
$display_options['fields']['title']['settings']['link_to_entity'] = $row_plugin === 'titles_linked';
$display_options['fields']['title']['plugin_id'] = 'field';
break;
}
}
......
......@@ -48,8 +48,8 @@ public function testNodeRevisionRelationship() {
$node_revision->save();
$column_map = array(
'vid' => 'vid',
'node_field_revision_nid' => 'node_revision_nid',
'node_field_data_node_field_revision_nid' => 'node_node_revision_nid',
'nid_1' => 'nid_1',
);
// Here should be two rows.
......@@ -58,13 +58,14 @@ public function testNodeRevisionRelationship() {
$resultset_nid = array(
array(
'vid' => '1',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
),
array(
'vid' => '2',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
),
);
$this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map);
......@@ -75,8 +76,8 @@ public function testNodeRevisionRelationship() {
$resultset_vid = array(
array(
'vid' => '2',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
'nid_1' => '1',
),
);
$this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map);
......
......@@ -72,7 +72,6 @@ display:
html: false
hide_empty: false
empty_zero: false
link_to_node: true
relationship: none
group_type: group
admin_label: ''
......@@ -89,7 +88,7 @@ display:
hide_alter_empty: true
entity_type: node
entity_field: title
plugin_id: node
plugin_id: field
filters:
status:
value: true
......
......@@ -26,7 +26,7 @@ display:
id: nid
table: node_field_data
field: nid
plugin_id: node
plugin_id: field
entity_type: node
entity_field: nid
filter_groups:
......
......@@ -107,8 +107,7 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
link_to_node: false
plugin_id: node
plugin_id: field
entity_type: node
entity_field: title
langcode:
......
......@@ -33,7 +33,7 @@ display:
id: title
table: node_field_data
field: title
plugin_id: node
plugin_id: field
entity_type: node
entity_field: title
sorts:
......
......@@ -20,20 +20,20 @@ display:
table: node_field_revision
field: nid
required: true
plugin_id: standard
plugin_id: field
fields:
vid:
id: vid
table: node_field_revision
field: vid
plugin_id: standard
plugin_id: field
entity_type: node
entity_field: vid
nid_1:
id: nid_1
table: node_field_revision
field: nid
plugin_id: standard
plugin_id: field
entity_type: node
entity_field: nid
nid:
......@@ -41,7 +41,7 @@ display:
table: node_field_data
field: nid
relationship: nid
plugin_id: node
plugin_id: field
entity_type: node
entity_field: nid
arguments:
......
......@@ -26,14 +26,14 @@ display:
id: vid
table: node_field_revision
field: vid
plugin_id: standard
plugin_id: field
entity_type: node
entity_field: vid
nid_1:
id: nid_1
table: node_field_revision
field: nid
plugin_id: standard
plugin_id: field
entity_type: node
entity_field: nid
nid:
......@@ -41,7 +41,7 @@ display:
table: node_field_data
field: nid
relationship: vid
plugin_id: node
plugin_id: field
entity_type: node
entity_field: nid
arguments:
......
......@@ -118,8 +118,7 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
link_to_node: false
plugin_id: node
plugin_id: field
entity_type: node
entity_field: nid
filters:
......
......@@ -82,8 +82,7 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
link_to_node: false
plugin_id: node
plugin_id: field
entity_type: node
entity_field: title
filters:
......
......@@ -10,7 +10,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Field\AllowedTagsXssTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\field\Views\FieldAPIHandlerTrait;
use Drupal\views\FieldAPIHandlerTrait;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument\Numeric;
......
......@@ -9,7 +9,7 @@
use Drupal\Core\Field\AllowedTagsXssTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\field\Views\FieldAPIHandlerTrait;
use Drupal\views\FieldAPIHandlerTrait;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument\String;
......
......@@ -7,7 +7,7 @@
namespace Drupal\options\Plugin\views\filter;
use Drupal\field\Views\FieldAPIHandlerTrait;
use Drupal\views\FieldAPIHandlerTrait;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\filter\ManyToOne;
use Drupal\views\ViewExecutable;
......
......@@ -72,7 +72,6 @@ display:
html: false
hide_empty: false
empty_zero: false
link_to_node: true
relationship: none
group_type: group
admin_label: ''
......@@ -87,7 +86,7 @@ display:
element_default_classes: true
empty: ''
hide_alter_empty: true
plugin_id: node
plugin_id: field
filters:
status:
value: true
......
......@@ -72,7 +72,6 @@ display:
html: false
hide_empty: false
empty_zero: false
link_to_node: true
relationship: none
group_type: group
admin_label: ''
......@@ -87,7 +86,7 @@ display:
element_default_classes: true
empty: ''
hide_alter_empty: true
plugin_id: node
plugin_id: