Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -47,7 +47,7 @@ $existing_blocks = unserialize($existing_blocks);
$connection->update('key_value')
->fields([
'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2354889', 'block.block.secondtestfor2354889', 'block.block.thirdtestfor2354889']))
'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2354889', 'block.block.secondtestfor2354889', 'block.block.thirdtestfor2354889'])),
])
->condition('collection', 'config.entity.key_store.block')
->condition('name', 'theme:bartik')

View file

@ -7,7 +7,6 @@
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
$config = unserialize($connection->query("SELECT data FROM {config} where name = :name", [':name' => 'core.extension'])->fetchField());

View file

@ -0,0 +1,162 @@
<?php
/**
* @file
* Contains database additions to
* drupal-8.2.1.bare.standard_with_entity_test_enabled.php.gz for testing the
* upgrade path of https://www.drupal.org/node/2248983.
*/
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Data for entity type "entity_test_revlog"
$connection->insert('entity_test_revlog')
->fields([
'id',
'revision_id',
'type',
'uuid',
'langcode',
'revision_created',
'revision_user',
'revision_log_message',
'name',
])
->values([
'id' => '1',
'revision_id' => '2',
'type' => 'entity_test_revlog',
'uuid' => 'f0b962b1-391b-441b-a664-2468ad520d96',
'langcode' => 'en',
'revision_created' => '1476268518',
'revision_user' => '1',
'revision_log_message' => 'second revision',
'name' => 'entity 1',
])
->execute();
$connection->insert('entity_test_revlog_revision')
->fields([
'id',
'revision_id',
'langcode',
'revision_created',
'revision_user',
'revision_log_message',
'name',
])
->values([
'id' => '1',
'revision_id' => '1',
'langcode' => 'en',
'revision_created' => '1476268517',
'revision_user' => '1',
'revision_log_message' => 'first revision',
'name' => 'entity 1',
])
->values([
'id' => '1',
'revision_id' => '2',
'langcode' => 'en',
'revision_created' => '1476268518',
'revision_user' => '1',
'revision_log_message' => 'second revision',
'name' => 'entity 1',
])
->execute();
// Data for entity type "entity_test_mul_revlog"
$connection->insert('entity_test_mul_revlog')
->fields([
'id',
'revision_id',
'type',
'uuid',
'langcode',
])
->values([
'id' => '1',
'revision_id' => '2',
'type' => 'entity_test_mul_revlog',
'uuid' => '6f04027a-1cbd-46e3-a67e-72636b493d4f',
'langcode' => 'en',
])
->execute();
$connection->insert('entity_test_mul_revlog_field_data')
->fields([
'id',
'revision_id',
'type',
'langcode',
'revision_created',
'revision_user',
'revision_log_message',
'name',
'default_langcode',
])
->values([
'id' => '1',
'revision_id' => '2',
'type' => 'entity_test_mul_revlog',
'langcode' => 'en',
'revision_created' => '1476268518',
'revision_user' => '1',
'revision_log_message' => 'second revision',
'name' => 'entity 1',
'default_langcode' => '1',
])
->execute();
$connection->insert('entity_test_mul_revlog_field_revision')
->fields([
'id',
'revision_id',
'langcode',
'revision_created',
'revision_user',
'revision_log_message',
'name',
'default_langcode',
])
->values([
'id' => '1',
'revision_id' => '1',
'langcode' => 'en',
'revision_created' => '1476268517',
'revision_user' => '1',
'revision_log_message' => 'first revision',
'name' => 'entity 1',
'default_langcode' => '1',
])
->values([
'id' => '1',
'revision_id' => '2',
'langcode' => 'en',
'revision_created' => '1476268518',
'revision_user' => '1',
'revision_log_message' => 'second revision',
'name' => 'entity 1',
'default_langcode' => '1',
])
->execute();
$connection->insert('entity_test_mul_revlog_revision')
->fields([
'id',
'revision_id',
'langcode',
])
->values([
'id' => '1',
'revision_id' => '1',
'langcode' => 'en',
])
->values([
'id' => '1',
'revision_id' => '2',
'langcode' => 'en',
])
->execute();

View file

@ -0,0 +1,24 @@
<?php
// @codingStandardsIgnoreFile
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Simulate an entity type that had previously set an initial key schema for a
// field.
$schema = $connection->select('key_value')
->fields('key_value', ['value'])
->condition('collection', 'entity.storage_schema.sql')
->condition('name', 'entity_test_update.field_schema_data.name')
->execute()
->fetchField();
$schema = unserialize($schema);
$schema['entity_test_update']['fields']['name']['initial'] = 'test';
$connection->update('key_value')
->fields(['value' => serialize($schema)])
->condition('collection', 'entity.storage_schema.sql')
->condition('name', 'entity_test_update.field_schema_data.name')
->execute();

View file

@ -0,0 +1,36 @@
<?php
// @codingStandardsIgnoreFile
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
->fields([
'value' => 'i:8000;',
'name' => 'entity_test_schema_converter',
'collection' => 'system.schema',
])
->condition('collection', 'system.schema')
->condition('name', 'entity_test_schema_converter')
->execute();
// Update core.extension.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['entity_test_schema_converter'] = 8000;
$connection->update('config')
->fields([
'data' => serialize($extensions),
'collection' => '',
'name' => 'core.extension',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();

View file

@ -40,7 +40,7 @@ $existing_blocks = unserialize($existing_blocks);
$connection->update('key_value')
->fields([
'value' => serialize(array_merge($existing_blocks, ['block.block.seven_local_actions']))
'value' => serialize(array_merge($existing_blocks, ['block.block.seven_local_actions'])),
])
->condition('collection', 'config.entity.key_store.block')
->condition('name', 'theme:seven')
@ -55,7 +55,7 @@ $extensions = $connection->select('config')
$extensions = unserialize($extensions);
$connection->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_theme' => 0]]))
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_theme' => 0]])),
])
->condition('name', 'core.extension')
->execute();

View file

@ -40,7 +40,7 @@ $existing_blocks = unserialize($existing_blocks);
$connection->update('key_value')
->fields([
'value' => serialize(array_merge($existing_blocks, ['block.block.bartik_page_title']))
'value' => serialize(array_merge($existing_blocks, ['block.block.bartik_page_title'])),
])
->condition('collection', 'config.entity.key_store.block')
->condition('name', 'theme:bartik')
@ -55,7 +55,7 @@ $extensions = $connection->select('config')
$extensions = unserialize($extensions);
$connection->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_theme' => 0]]))
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_theme' => 0]])),
])
->condition('name', 'core.extension')
->execute();

View file

@ -40,7 +40,7 @@ $existing_blocks = unserialize($existing_blocks);
$connection->update('key_value')
->fields([
'value' => serialize(array_merge($existing_blocks, ['block.block.seven_secondary_local_tasks']))
'value' => serialize(array_merge($existing_blocks, ['block.block.seven_secondary_local_tasks'])),
])
->condition('collection', 'config.entity.key_store.block')
->condition('name', 'theme:seven')

View file

@ -40,7 +40,7 @@ $existing_blocks = unserialize($existing_blocks);
$connection->update('key_value')
->fields([
'value' => serialize(array_merge($existing_blocks, ['block.block.bartik_branding']))
'value' => serialize(array_merge($existing_blocks, ['block.block.bartik_branding'])),
])
->condition('collection', 'config.entity.key_store.block')
->condition('name', 'theme:bartik')
@ -55,7 +55,7 @@ $extensions = $connection->select('config')
$extensions = unserialize($extensions);
$connection->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_theme' => 0]]))
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_theme' => 0]])),
])
->condition('name', 'core.extension')
->execute();

View file

@ -19,7 +19,7 @@ $extensions = $connection->select('config')
$extensions = unserialize($extensions);
$connection->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_stable' => 0]]))
'data' => serialize(array_merge_recursive($extensions, ['theme' => ['test_stable' => 0]])),
])
->condition('name', 'core.extension')
->execute();

View file

@ -43,7 +43,7 @@ $existing_blocks = unserialize($existing_blocks);
$connection->update('key_value')
->fields([
'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2513534', 'block.block.secondtestfor2513534']))
'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2513534', 'block.block.secondtestfor2513534'])),
])
->condition('collection', 'config.entity.key_store.block')
->condition('name', 'theme:bartik')

View file

@ -0,0 +1,32 @@
<?php
/**
* @file
* Contains database additions to drupal-8.bare.standard.php.gz for testing the
* upgrade path of https://www.drupal.org/node/2455125.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
// Structure of a view with timestamp fields.
$views_configs = [];
$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2846614.yml'));
foreach ($views_configs as $views_config) {
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'views.view.' . $views_config['id'],
'data' => serialize($views_config),
])
->execute();
}

View file

@ -0,0 +1,240 @@
uuid: 001475a0-daec-4e8a-8ca7-97b0d24100a6
langcode: en
status: true
dependencies:
module:
- user
id: test_user_multi_value
label: test_user_multi_value
module: views
description: ''
tag: ''
base_table: users_field_data
base_field: uid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access user profiles'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Filter
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous:
next:
style:
type: default
options:
grouping: { }
row_class: ''
default_row_class: true
uses_fields: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
roles:
id: roles
table: user__roles
field: roles
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: user
entity_field: roles
plugin_id: field
filters:
roles:
id: roles
table: user__roles
field: roles
relationship: none
group_type: group
admin_label: ''
operator: '='
value: ''
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: user
entity_field: roles
plugin_id: string
sorts: { }
header: { }
footer: { }
empty: { }
relationships: { }
arguments:
roles:
id: roles
table: user__roles
field: roles
relationship: none
group_type: group
admin_label: ''
default_action: ignore
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
glossary: false
limit: 0
case: none
path_case: none
transform_dash: false
break_phrase: false
entity_type: user
entity_field: roles
plugin_id: string
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- user.permissions
tags: { }

View file

@ -0,0 +1,35 @@
<?php
/**
* @file
* Contains database additions to
* drupal-8.2.1.bare.standard_with_entity_test_enabled.php.gz for testing the
* upgrade path of https://www.drupal.org/node/2248983.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
// View for the entity type "entity_test_revlog".
$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/views.view.entity_test_revlog_for_2248983.yml'));
// View for the entity type "entity_test_mul_revlog".
$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/views.view.entity_test_mul_revlog_for_2248983.yml'));
foreach ($views_configs as $views_config) {
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'views.view.' . $views_config['id'],
'data' => serialize($views_config),
])
->execute();
}

View file

@ -0,0 +1,67 @@
<?php
/**
* @file
* Contains database additions to drupal-8.bare.standard.php.gz for testing the
* upgrade path of https://www.drupal.org/node/2455125.
*/
use Drupal\Component\Uuid\Php;
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$view_file = __DIR__ . '/drupal-8.views-taxonomy-parent-2543726.yml';
$view_config = Yaml::decode(file_get_contents($view_file));
$connection->insert('config')
->fields(['collection', 'name', 'data'])
->values([
'collection' => '',
'name' => "views.view.test_taxonomy_parent",
'data' => serialize($view_config),
])
->execute();
$uuid = new Php();
// The root tid.
$tids = [0];
for ($i = 0; $i < 4; $i++) {
$name = $this->randomString();
$tid = $connection->insert('taxonomy_term_data')
->fields(['vid', 'uuid', 'langcode'])
->values(['vid' => 'tags', 'uuid' => $uuid->generate(), 'langcode' => 'en'])
->execute();
$connection->insert('taxonomy_term_field_data')
->fields(['tid', 'vid', 'langcode', 'name', 'weight', 'changed', 'default_langcode'])
->values(['tid' => $tid, 'vid' => 'tags', 'langcode' => 'en', 'name' => $name, 'weight' => 0, 'changed' => REQUEST_TIME, 'default_langcode' => 1])
->execute();
$tids[] = $tid;
}
$hierarchy = [
// Term with tid 1 has terms with tids 2 and 3 as parents.
1 => [2, 3],
2 => [3, 0],
3 => [0],
];
$query = $connection->insert('taxonomy_term_hierarchy')->fields(['tid', 'parent']);
foreach ($hierarchy as $tid => $parents) {
foreach ($parents as $parent) {
$query->values(['tid' => $tids[$tid], 'parent' => $tids[$parent]]);
}
}
// Insert an extra record with no corresponding term.
// See https://www.drupal.org/project/drupal/issues/2997982
$query->values(['tid' => max($tids) + 1, 'parent' => 0]);
$query->execute();

View file

@ -0,0 +1,222 @@
langcode: en
status: true
dependencies:
module:
- taxonomy
- user
id: test_taxonomy_parent
label: test_taxonomy_parent
module: views
description: ''
tag: ''
base_table: taxonomy_term_data
base_field: tid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access content'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: full
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ' Previous'
next: 'Next '
first: '« First'
last: 'Last »'
quantity: 9
style:
type: default
options:
grouping: { }
row_class: ''
default_row_class: true
uses_fields: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
name:
id: name
table: taxonomy_term_data
field: name
label: ''
alter:
alter_text: false
make_link: false
absolute: false
trim: false
word_boundary: false
ellipsis: false
strip_tags: false
html: false
hide_empty: false
empty_zero: false
relationship: none
group_type: group
admin_label: ''
exclude: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_alter_empty: true
plugin_id: field
type: string
settings:
link_to_entity: true
entity_type: taxonomy_term
entity_field: name
filters:
parent:
id: parent
table: taxonomy_term_hierarchy
field: parent
relationship: field_tags
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
group: 1
exposed: true
expose:
operator_id: parent_op
label: 'Parent term'
description: ''
use_operator: false
operator: parent_op
identifier: parent
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: ''
min_placeholder: ''
max_placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: numeric
parent_1:
id: parent_1
table: taxonomy_term_hierarchy
field: parent
relationship: field_tags
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
group: 1
exposed: true
expose:
operator_id: parent_1_op
label: 'Parent term'
description: ''
use_operator: false
operator: parent_1_op
identifier: parent_1
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: ''
min_placeholder: ''
max_placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: numeric
sorts: { }
header: { }
footer: { }
empty: { }
relationships:
parent:
id: parent
table: taxonomy_term__parent
field: parent_target_id
relationship: none
group_type: group
admin_label: Parent
required: true
plugin_id: standard
arguments: { }

View file

@ -0,0 +1,435 @@
uuid: 25b89168-a8e5-4ae1-8fb5-c8efb91f0938
langcode: en
status: true
dependencies:
module:
- entity_test_revlog
id: entity_test_mul_revlog_for_2248983
label: entity_test_mul_revlog
module: views
description: ''
tag: ''
base_table: entity_test_mul_revlog_property_data
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous:
next:
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
override: true
sticky: false
caption: ''
summary: ''
description: ''
columns:
name: name
info:
name:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
name:
table: entity_test_mul_revlog_property_data
field: name
id: name
entity_type: entity_test_mul_revlog
entity_field: name
plugin_id: field
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
revision_created:
id: revision_created
table: entity_test_mul_revlog_property_data
field: revision_created
relationship: none
group_type: group
admin_label: ''
label: 'Revision create time'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: timestamp
settings:
date_format: medium
custom_date_format: ''
timezone: ''
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_mul_revlog
entity_field: revision_created
plugin_id: field
revision_id:
id: revision_id
table: entity_test_mul_revlog_property_data
field: revision_id
relationship: none
group_type: group
admin_label: ''
label: 'Revision ID'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: number_integer
settings:
thousand_separator: ''
prefix_suffix: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_mul_revlog
entity_field: revision_id
plugin_id: field
revision_log_message:
id: revision_log_message
table: entity_test_mul_revlog_property_data
field: revision_log_message
relationship: none
group_type: group
admin_label: ''
label: 'Revision log message'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: basic_string
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_mul_revlog
entity_field: revision_log_message
plugin_id: field
revision_user:
id: revision_user
table: entity_test_mul_revlog_property_data
field: revision_user
relationship: none
group_type: group
admin_label: ''
label: 'Revision user'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_mul_revlog
entity_field: revision_user
plugin_id: field
filters: { }
sorts: { }
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
tags: { }

View file

@ -0,0 +1,436 @@
uuid: 5a8b00d2-67ce-415b-9e7d-6c013bf7f6b8
langcode: en
status: true
dependencies:
module:
- entity_test_revlog
id: entity_test_revlog_for_2248983
label: entity_test_revlog
module: views
description: ''
tag: ''
base_table: entity_test_revlog
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous:
next:
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
override: true
sticky: false
caption: ''
summary: ''
description: ''
columns:
name: name
info:
name:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
name:
id: name
table: entity_test_revlog
field: name
relationship: none
group_type: group
admin_label: ''
label: Name
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_revlog
entity_field: name
plugin_id: field
revision_created:
id: revision_created
table: entity_test_revlog
field: revision_created
relationship: none
group_type: group
admin_label: ''
label: 'Revision create time'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: timestamp
settings:
date_format: medium
custom_date_format: ''
timezone: ''
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_revlog
entity_field: revision_created
plugin_id: field
revision_id:
id: revision_id
table: entity_test_revlog
field: revision_id
relationship: none
group_type: group
admin_label: ''
label: 'Revision ID'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: number_integer
settings:
thousand_separator: ''
prefix_suffix: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_revlog
entity_field: revision_id
plugin_id: field
revision_log_message:
id: revision_log_message
table: entity_test_revlog
field: revision_log_message
relationship: none
group_type: group
admin_label: ''
label: 'Revision log message'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: basic_string
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_revlog
entity_field: revision_log_message
plugin_id: field
revision_user:
id: revision_user
table: entity_test_revlog
field: revision_user
relationship: none
group_type: group
admin_label: ''
label: 'Revision user'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: entity_test_revlog
entity_field: revision_user
plugin_id: field
filters: { }
sorts: { }
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
tags: { }

View file

@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* Example implementation of accept header based content negotation.
* Example implementation of "accept header"-based content negotiation.
*/
class AcceptHeaderMiddleware implements HttpKernelInterface {

View file

@ -14,7 +14,7 @@ class AcceptHeaderRoutingTestServiceProvider implements ServiceModifierInterface
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
// Remove the basic content negotation middleware and replace it with a
// Remove the basic content negotiation middleware and replace it with a
// basic header based one.
$container->register('http_middleware.negotiation', 'Drupal\accept_header_routing_test\AcceptHeaderMiddleware')
->addTag('http_middleware', ['priority' => 400]);

View file

@ -2,16 +2,15 @@
namespace Drupal\accept_header_routing_test\Routing;
use Drupal\Core\Routing\RouteFilterInterface;
use Drupal\Core\Routing\FilterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Filters routes based on the media type specified in the HTTP Accept headers.
*/
class AcceptHeaderMatcher implements RouteFilterInterface {
class AcceptHeaderMatcher implements FilterInterface {
/**
* {@inheritdoc}
@ -59,11 +58,4 @@ class AcceptHeaderMatcher implements RouteFilterInterface {
throw new NotAcceptableHttpException('No route found for the specified formats ' . implode(' ', $acceptable_mime_types));
}
/**
* {@inheritdoc}
*/
public function applies(Route $route) {
return TRUE;
}
}

View file

@ -180,8 +180,8 @@ function ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInte
* Ajax form callback: Selects the 'drivertext' element of the validation form.
*/
function ajax_forms_test_validation_form_callback($form, FormStateInterface $form_state) {
drupal_set_message("ajax_forms_test_validation_form_callback invoked");
drupal_set_message(t("Callback: drivertext=%drivertext, spare_required_field=%spare_required_field", ['%drivertext' => $form_state->getValue('drivertext'), '%spare_required_field' => $form_state->getValue('spare_required_field')]));
\Drupal::messenger()->addStatus("ajax_forms_test_validation_form_callback invoked");
\Drupal::messenger()->addStatus(t("Callback: drivertext=%drivertext, spare_required_field=%spare_required_field", ['%drivertext' => $form_state->getValue('drivertext'), '%spare_required_field' => $form_state->getValue('spare_required_field')]));
return ['#markup' => '<div id="message_area">ajax_forms_test_validation_form_callback at ' . date('c') . '</div>'];
}
@ -189,8 +189,8 @@ function ajax_forms_test_validation_form_callback($form, FormStateInterface $for
* Ajax form callback: Selects the 'drivernumber' element of the validation form.
*/
function ajax_forms_test_validation_number_form_callback($form, FormStateInterface $form_state) {
drupal_set_message("ajax_forms_test_validation_number_form_callback invoked");
drupal_set_message(t("Callback: drivernumber=%drivernumber, spare_required_field=%spare_required_field", ['%drivernumber' => $form_state->getValue('drivernumber'), '%spare_required_field' => $form_state->getValue('spare_required_field')]));
\Drupal::messenger()->addStatus("ajax_forms_test_validation_number_form_callback invoked");
\Drupal::messenger()->addStatus(t("Callback: drivernumber=%drivernumber, spare_required_field=%spare_required_field", ['%drivernumber' => $form_state->getValue('drivernumber'), '%spare_required_field' => $form_state->getValue('spare_required_field')]));
return ['#markup' => '<div id="message_area_number">ajax_forms_test_validation_number_form_callback at ' . date('c') . '</div>'];
}

View file

@ -30,3 +30,18 @@ ajax_forms_test.lazy_load_form:
requirements:
_access: 'TRUE'
ajax_forms_test.image_button_form:
path: '/ajax_forms_image_button_form'
defaults:
_title: 'AJAX forms image button test'
_form: '\Drupal\ajax_forms_test\Form\AjaxFormsTestImageButtonForm'
requirements:
_access: 'TRUE'
ajax_forms_test.ajax_element_form:
path: '/ajax_forms_test_ajax_element_form'
defaults:
_title: 'AJAX forms elements test'
_form: '\Drupal\ajax_forms_test\Form\AjaxFormsTestAjaxElementsForm'
requirements:
_access: 'TRUE'

View file

@ -22,6 +22,29 @@ class Callbacks {
return $response;
}
/**
* Ajax callback triggered by date.
*/
public function dateCallback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$date = $form_state->getValue('date');
$response->addCommand(new HtmlCommand('#ajax_date_value', sprintf('<div>%s</div>', $date)));
$response->addCommand(new DataCommand('#ajax_date_value', 'form_state_value_date', $form_state->getValue('date')));
return $response;
}
/**
* Ajax callback triggered by datetime.
*/
public function datetimeCallback($form, FormStateInterface $form_state) {
$datetime = $form_state->getValue('datetime')['date'] . ' ' . $form_state->getValue('datetime')['time'];
$response = new AjaxResponse();
$response->addCommand(new HtmlCommand('#ajax_datetime_value', sprintf('<div>%s</div>', $datetime)));
$response->addCommand(new DataCommand('#ajax_datetime_value', 'form_state_value_datetime', $datetime));
return $response;
}
/**
* Ajax callback triggered by checkbox.
*/
@ -32,6 +55,15 @@ class Callbacks {
return $response;
}
/**
* Ajax callback to confirm image button was submitted.
*/
public function imageButtonCallback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new HtmlCommand('#ajax_image_button_result', "<div id='ajax-1-more-div'>Something witty!</div>"));
return $response;
}
/**
* Ajax callback triggered by the checkbox in a #group.
*/

View file

@ -0,0 +1,59 @@
<?php
namespace Drupal\ajax_forms_test\Form;
use Drupal\Core\Form\FormBase;
use Drupal\ajax_forms_test\Callbacks;
use Drupal\Core\Form\FormStateInterface;
/**
* Form builder: Builds a form that has each FAPI elements triggering a simple
* Ajax callback.
*
* @internal
*/
class AjaxFormsTestAjaxElementsForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'ajax_forms_test_ajax_elements_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$callback_object = new Callbacks();
$form['date'] = [
'#type' => 'date',
'#ajax' => [
'callback' => [$callback_object, 'dateCallback'],
],
'#suffix' => '<div id="ajax_date_value">No date yet selected</div>',
];
$form['datetime'] = [
'#type' => 'datetime',
'#ajax' => [
'callback' => [$callback_object, 'datetimeCallback'],
'wrapper' => 'ajax_datetime_value',
],
];
$form['datetime_result'] = [
'#type' => 'markup',
'#markup' => '<div id="ajax_datetime_value">No datetime selected.</div>',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {}
}

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Form constructor for the Ajax Command display form.
*
* @internal
*/
class AjaxFormsTestCommandsForm extends FormBase {
@ -52,7 +54,6 @@ class AjaxFormsTestCommandsForm extends FormBase {
'#suffix' => '<div id="append_div">Append inside this div</div>',
];
// Shows the 'before' command.
$form['before_command_example'] = [
'#value' => $this->t("AJAX 'before': Click to put something before the div"),
@ -91,7 +92,6 @@ class AjaxFormsTestCommandsForm extends FormBase {
'#suffix' => '<div id="css_div" style="height: 50px; width: 50px; border: 1px solid black"> box</div>',
];
// Shows the Ajax 'data' command. But there is no use of this information,
// as this would require a javascript client to use the data.
$form['data_command_example'] = [

View file

@ -0,0 +1,50 @@
<?php
namespace Drupal\ajax_forms_test\Form;
use Drupal\ajax_forms_test\Callbacks;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Form builder: Builds a form that has image button with an ajax callback.
*
* @internal
*/
class AjaxFormsTestImageButtonForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'ajax_forms_test_image_button_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$object = new Callbacks();
$form['image_button'] = [
'#type' => 'image_button',
'#name' => 'image_button',
'#src' => 'core/misc/icons/787878/cog.svg',
'#attributes' => ['alt' => $this->t('Edit')],
'#op' => 'edit',
'#ajax' => [
'callback' => [$object, 'imageButtonCallback'],
],
'#suffix' => '<div id="ajax_image_button_result">Image button not pressed yet.</div>',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// No submit code needed.
}
}

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Form builder: Builds a form that triggers a simple AJAX callback.
*
* @internal
*/
class AjaxFormsTestLazyLoadForm extends FormBase {

View file

@ -8,6 +8,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Form builder: Builds a form that triggers a simple AJAX callback.
*
* @internal
*/
class AjaxFormsTestSimpleForm extends FormBase {
@ -31,7 +33,8 @@ class AjaxFormsTestSimpleForm extends FormBase {
'#options' => [
'red' => 'red',
'green' => 'green',
'blue' => 'blue'],
'blue' => 'blue',
],
'#ajax' => [
'callback' => [$object, 'selectCallback'],
],
@ -108,7 +111,6 @@ class AjaxFormsTestSimpleForm extends FormBase {
'#title' => $this->t('Another AJAX checkbox in a nested group'),
];
return $form;
}

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Form builder: Builds a form that triggers a simple AJAX callback.
*
* @internal
*/
class AjaxFormsTestValidationForm extends FormBase {
@ -65,7 +67,7 @@ class AjaxFormsTestValidationForm extends FormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
drupal_set_message($this->t("Validation form submitted"));
$this->messenger()->addStatus($this->t("Validation form submitted"));
}
}

View file

@ -6,6 +6,7 @@ use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -27,6 +28,13 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory
*/
protected $formBuilder;
/**
* The messenger.
*
* @var \Drupal\Core\Messenger\MessengerInterface
*/
protected $messenger;
/**
* Constructs a new AjaxFormBlock.
*
@ -38,10 +46,13 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory
* The plugin implementation definition.
* @param \Drupal\Core\Form\FormBuilderInterface $form_builder
* The form builder.
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* The messenger.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, FormBuilderInterface $form_builder) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, FormBuilderInterface $form_builder, MessengerInterface $messenger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->formBuilder = $form_builder;
$this->messenger = $messenger;
}
/**
@ -52,7 +63,8 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory
$configuration,
$plugin_id,
$plugin_definition,
$container->get('form_builder')
$container->get('form_builder'),
$container->get('messenger')
);
}
@ -129,7 +141,7 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
drupal_set_message('Submission successful.');
$this->messenger->addStatus('Submission successful.');
}
}

View file

@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- contact
- drupal:contact

View file

@ -1,3 +1,8 @@
ajax_insert:
js:
js/insert-ajax.js: {}
dependencies:
- core/drupal.ajax
order:
drupalSettings:
ajax: test

View file

@ -6,6 +6,14 @@ ajax_test.dialog_contents:
requirements:
_access: 'TRUE'
ajax_test.ajax_render_types:
path: '/ajax-test/dialog-contents-types/{type}'
defaults:
_title: 'AJAX Dialog contents routing'
_controller: '\Drupal\ajax_test\Controller\AjaxTestController::renderTypes'
requirements:
_access: 'TRUE'
ajax_test.dialog_form:
path: '/ajax-test/dialog-form'
defaults:
@ -21,6 +29,20 @@ ajax_test.dialog:
requirements:
_access: 'TRUE'
ajax_test.insert_links_block_wrapper:
path: '/ajax-test/insert-block-wrapper'
defaults:
_controller: '\Drupal\ajax_test\Controller\AjaxTestController::insertLinksBlockWrapper'
requirements:
_access: 'TRUE'
ajax_test.insert_links_inline_wrapper:
path: '/ajax-test/insert-inline-wrapper'
defaults:
_controller: '\Drupal\ajax_test\Controller\AjaxTestController::insertLinksInlineWrapper'
requirements:
_access: 'TRUE'
ajax_test.dialog_close:
path: '/ajax-test/dialog-close'
defaults:

View file

@ -0,0 +1,45 @@
/**
* @file
* Drupal behavior to attach click event handlers to ajax-insert and
* ajax-insert-inline links for testing ajax requests.
*/
(function($, window, Drupal) {
Drupal.behaviors.insertTest = {
attach(context) {
$('.ajax-insert')
.once('ajax-insert')
.on('click', event => {
event.preventDefault();
const ajaxSettings = {
url: event.currentTarget.getAttribute('href'),
wrapper: 'ajax-target',
base: false,
element: false,
method: event.currentTarget.getAttribute('data-method'),
effect: event.currentTarget.getAttribute('data-effect'),
};
const myAjaxObject = Drupal.ajax(ajaxSettings);
myAjaxObject.execute();
});
$('.ajax-insert-inline')
.once('ajax-insert')
.on('click', event => {
event.preventDefault();
const ajaxSettings = {
url: event.currentTarget.getAttribute('href'),
wrapper: 'ajax-target-inline',
base: false,
element: false,
method: event.currentTarget.getAttribute('data-method'),
effect: event.currentTarget.getAttribute('data-effect'),
};
const myAjaxObject = Drupal.ajax(ajaxSettings);
myAjaxObject.execute();
});
$(context).addClass('processed');
},
};
})(jQuery, window, Drupal);

View file

@ -0,0 +1,42 @@
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, window, Drupal) {
Drupal.behaviors.insertTest = {
attach: function attach(context) {
$('.ajax-insert').once('ajax-insert').on('click', function (event) {
event.preventDefault();
var ajaxSettings = {
url: event.currentTarget.getAttribute('href'),
wrapper: 'ajax-target',
base: false,
element: false,
method: event.currentTarget.getAttribute('data-method'),
effect: event.currentTarget.getAttribute('data-effect')
};
var myAjaxObject = Drupal.ajax(ajaxSettings);
myAjaxObject.execute();
});
$('.ajax-insert-inline').once('ajax-insert').on('click', function (event) {
event.preventDefault();
var ajaxSettings = {
url: event.currentTarget.getAttribute('href'),
wrapper: 'ajax-target-inline',
base: false,
element: false,
method: event.currentTarget.getAttribute('data-method'),
effect: event.currentTarget.getAttribute('data-effect')
};
var myAjaxObject = Drupal.ajax(ajaxSettings);
myAjaxObject.execute();
});
$(context).addClass('processed');
}
};
})(jQuery, window, Drupal);

View file

@ -42,6 +42,101 @@ class AjaxTestController {
return $content;
}
/**
* Example content for testing the wrapper of the response.
*
* @param string $type
* Type of response.
*
* @return array
* Renderable array of AJAX response contents.
*/
public function renderTypes($type) {
return [
'#title' => '<em>AJAX Dialog & contents</em>',
'content' => [
'#type' => 'inline_template',
'#template' => $this->getRenderTypes()[$type]['render'],
],
];
}
/**
* Returns a render array of links that directly Drupal.ajax().
*
* @return array
* Renderable array of AJAX response contents.
*/
public function insertLinksBlockWrapper() {
$methods = [
'html',
'replaceWith',
];
$build['links'] = [
'ajax_target' => [
'#markup' => '<div class="ajax-target-wrapper"><div id="ajax-target">Target</div></div>',
],
'links' => [
'#theme' => 'links',
'#attached' => ['library' => ['ajax_test/ajax_insert']],
],
];
foreach ($methods as $method) {
foreach ($this->getRenderTypes() as $type => $item) {
$class = 'ajax-insert';
$build['links']['links']['#links']["$method-$type"] = [
'title' => "Link $method $type",
'url' => Url::fromRoute('ajax_test.ajax_render_types', ['type' => $type]),
'attributes' => [
'class' => [$class],
'data-method' => $method,
'data-effect' => $item['effect'],
],
];
}
}
return $build;
}
/**
* Returns a render array of links that directly Drupal.ajax().
*
* @return array
* Renderable array of AJAX response contents.
*/
public function insertLinksInlineWrapper() {
$methods = [
'html',
'replaceWith',
];
$build['links'] = [
'ajax_target' => [
'#markup' => '<div class="ajax-target-wrapper"><span id="ajax-target-inline">Target inline</span></div>',
],
'links' => [
'#theme' => 'links',
'#attached' => ['library' => ['ajax_test/ajax_insert']],
],
];
foreach ($methods as $method) {
foreach ($this->getRenderTypes() as $type => $item) {
$class = 'ajax-insert-inline';
$build['links']['links']['#links']["$method-$type"] = [
'title' => "Link $method $type",
'url' => Url::fromRoute('ajax_test.ajax_render_types', ['type' => $type]),
'attributes' => [
'class' => [$class],
'data-method' => $method,
'data-effect' => $item['effect'],
],
];
}
}
return $build;
}
/**
* Returns a render array that will be rendered by AjaxRenderer.
*
@ -139,7 +234,7 @@ class AjaxTestController {
'data-dialog-type' => 'modal',
'data-dialog-options' => json_encode([
'width' => 400,
])
]),
],
],
'link3' => [
@ -151,7 +246,7 @@ class AjaxTestController {
'data-dialog-options' => json_encode([
'target' => 'ajax-test-dialog-wrapper-1',
'width' => 800,
])
]),
],
],
'link4' => [
@ -179,7 +274,7 @@ class AjaxTestController {
'data-dialog-options' => json_encode([
'width' => 800,
'height' => 500,
])
]),
],
],
'link7' => [
@ -190,7 +285,7 @@ class AjaxTestController {
'data-dialog-type' => 'dialog',
'data-dialog-options' => json_encode([
'width' => 800,
])
]),
],
],
'link8' => [
@ -222,4 +317,41 @@ class AjaxTestController {
return $response;
}
/**
* Render types.
*
* @return array
* Render types.
*/
protected function getRenderTypes() {
$render_single_root = [
'pre-wrapped-div' => '<div class="pre-wrapped">pre-wrapped<script> var test;</script></div>',
'pre-wrapped-span' => '<span class="pre-wrapped">pre-wrapped<script> var test;</script></span>',
'pre-wrapped-whitespace' => ' <div class="pre-wrapped-whitespace">pre-wrapped-whitespace</div>' . "\r\n",
'not-wrapped' => 'not-wrapped',
'comment-string-not-wrapped' => '<!-- COMMENT -->comment-string-not-wrapped',
'comment-not-wrapped' => '<!-- COMMENT --><div class="comment-not-wrapped">comment-not-wrapped</div>',
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><rect x="0" y="0" height="10" width="10" fill="green"/></svg>',
'empty' => '',
];
$render_multiple_root = [
'mixed' => ' foo <!-- COMMENT --> foo bar<div class="a class"><p>some string</p></div> additional not wrapped strings, <!-- ANOTHER COMMENT --> <p>final string</p>',
'top-level-only' => '<div>element #1</div><div>element #2</div>',
'top-level-only-pre-whitespace' => ' <div>element #1</div><div>element #2</div> ',
'top-level-only-middle-whitespace-span' => '<span>element #1</span> <span>element #2</span>',
'top-level-only-middle-whitespace-div' => '<div>element #1</div> <div>element #2</div>',
];
$render_info = [];
foreach ($render_single_root as $key => $render) {
$render_info[$key] = ['render' => $render, 'effect' => 'fade'];
}
foreach ($render_multiple_root as $key => $render) {
$render_info[$key] = ['render' => $render, 'effect' => 'none'];
$render_info["$key--effect"] = ['render' => $render, 'effect' => 'fade'];
}
return $render_info;
}
}

View file

@ -11,6 +11,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Dummy form for testing DialogRenderer with _form routes.
*
* @internal
*/
class AjaxTestDialogForm extends FormBase {
@ -29,7 +31,7 @@ class AjaxTestDialogForm extends FormBase {
// to have a dummy field we can set in WebTestBase::drupalPostForm() else it won't
// submit anything.
$form['textfield'] = [
'#type' => 'hidden'
'#type' => 'hidden',
];
$form['button1'] = [
'#type' => 'submit',
@ -65,7 +67,6 @@ class AjaxTestDialogForm extends FormBase {
$form_state->setRedirect('ajax_test.dialog_contents');
}
/**
* AJAX callback handler for AjaxTestDialogForm.
*/
@ -80,7 +81,6 @@ class AjaxTestDialogForm extends FormBase {
return $this->dialog(FALSE);
}
/**
* Util to render dialog in ajax callback.
*

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Dummy form for testing DialogRenderer with _form routes.
*
* @internal
*/
class AjaxTestForm extends FormBase {

View file

@ -116,7 +116,7 @@ function _batch_test_finished_helper($batch_id, $success, $results, $operations)
],
];
drupal_set_message(\Drupal::service('renderer')->renderPlain($error_message));
\Drupal::messenger()->addStatus(\Drupal::service('renderer')->renderPlain($error_message));
}
/**

View file

@ -19,7 +19,7 @@ class BatchTestController {
return [
'success' => [
'#markup' => 'Redirection successful.',
]
],
];
}
@ -103,7 +103,7 @@ class BatchTestController {
return [
'success' => [
'#markup' => 'Got out of a programmatic batched form.',
]
],
];
}

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Generate form of id batch_test_chained_form.
*
* @internal
*/
class BatchTestChainedForm extends FormBase {

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Generate form of id batch_test_mock_form.
*
* @internal
*/
class BatchTestMockForm extends FormBase {

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Generate form of id batch_test_multistep_form.
*
* @internal
*/
class BatchTestMultiStepForm extends FormBase {

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Generate form of id batch_test_simple_form.
*
* @internal
*/
class BatchTestSimpleForm extends FormBase {

View file

@ -5,7 +5,7 @@
* Helper module for the Common tests.
*/
use \Drupal\Core\Asset\AttachedAssetsInterface;
use Drupal\Core\Asset\AttachedAssetsInterface;
/**
* Applies #printed to an element to help test #pre_render.

View file

@ -8,8 +8,8 @@
/**
* Implements hook_cron().
*
* common_test_cron() throws an exception, but the execution should reach this
* function as well.
* Function common_test_cron() throws an exception, but the execution should
* reach this function as well.
*
* @see common_test_cron()
*/

View file

@ -60,13 +60,13 @@ class FormController implements FormInterface {
$this->condition->submitConfigurationForm($form, $form_state);
$config = $this->condition->getConfig();
foreach ($config['bundles'] as $bundle) {
drupal_set_message('Bundle: ' . $bundle);
\Drupal::messenger()->addStatus('Bundle: ' . $bundle);
}
$article = Node::load(1);
$this->condition->setContextValue('node', $article);
if ($this->condition->execute()) {
drupal_set_message(t('Executed successfully.'));
\Drupal::messenger()->addStatus(t('Executed successfully.'));
}
}

View file

@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Test controller for content negotation tests.
* Test controller for content negotiation tests.
*/
class TestController {

View file

@ -47,7 +47,7 @@ function database_test_schema() {
],
'primary key' => ['id'],
'unique keys' => [
'name' => ['name']
'name' => ['name'],
],
'indexes' => [
'ages' => ['age'],
@ -148,7 +148,7 @@ function database_test_schema() {
],
'blob2' => [
'description' => 'A second BLOB field.',
'type' => 'blob'
'type' => 'blob',
],
],
'primary key' => ['id'],
@ -207,11 +207,12 @@ function database_test_schema() {
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0],
'default' => 0,
],
],
'primary key' => ['id'],
'unique keys' => [
'name' => ['name']
'name' => ['name'],
],
'indexes' => [
'ages' => ['age'],
@ -241,7 +242,7 @@ function database_test_schema() {
],
'primary key' => ['id'],
'unique keys' => [
'name' => ['name']
'name' => ['name'],
],
];
@ -286,6 +287,10 @@ function database_test_schema() {
'description' => 'A column with preserved name.',
'type' => 'text',
],
'function' => [
'description' => 'A column with reserved name in MySQL 8.',
'type' => 'text',
],
],
'primary key' => ['id'],
];

View file

@ -38,7 +38,6 @@ function database_test_query_alter(AlterableInterface $query) {
}
}
/**
* Implements hook_query_TAG_alter().
*

View file

@ -91,7 +91,7 @@ class DatabaseTestController {
'tid' => ['data' => t('Task ID'), 'field' => 'tid', 'sort' => 'desc'],
'pid' => ['data' => t('Person ID'), 'field' => 'pid'],
'task' => ['data' => t('Task'), 'field' => 'task'],
'priority' => ['data' => t('Priority'), 'field' => 'priority', ],
'priority' => ['data' => t('Priority'), 'field' => 'priority'],
];
$query = db_select('test_task', 't');
@ -123,7 +123,7 @@ class DatabaseTestController {
'tid' => ['data' => t('Task ID'), 'field' => 'tid', 'sort' => 'desc'],
'pid' => ['data' => t('Person ID'), 'field' => 'pid'],
'task' => ['data' => t('Task'), 'field' => 'task'],
'priority' => ['data' => t('Priority'), 'field' => 'priority', ],
'priority' => ['data' => t('Priority'), 'field' => 'priority'],
];
$query = db_select('test_task', 't');

View file

@ -8,6 +8,8 @@ use Drupal\user\Entity\User;
/**
* Form controller for database_test module.
*
* @internal
*/
class DatabaseTestForm extends FormBase {

View file

@ -0,0 +1,6 @@
name: 'Default format test'
type: module
description: 'Support module for testing default route format.'
package: Testing
version: VERSION
core: 8.x

View file

@ -0,0 +1,28 @@
default_format_test.machine:
path: '/default_format_test/machine'
defaults:
# Same controller + method!
_controller: '\Drupal\default_format_test\DefaultFormatTestController::content'
requirements:
_access: 'TRUE'
_format: 'json'
default_format_test.human:
path: '/default_format_test/human'
defaults:
# Same controller + method!
_controller: '\Drupal\default_format_test\DefaultFormatTestController::content'
requirements:
_access: 'TRUE'
_format: 'html'
# Route definition identical to default_format_test.machine, only different name.
# @see \Drupal\FunctionalTests\Routing\DefaultFormatTest::testMultiple
default_format_test.machine.alias:
path: '/default_format_test/machine'
defaults:
# Same controller + method!
_controller: '\Drupal\default_format_test\DefaultFormatTestController::content'
requirements:
_access: 'TRUE'
_format: 'json'

View file

@ -0,0 +1,15 @@
<?php
namespace Drupal\default_format_test;
use Drupal\Core\Cache\CacheableResponse;
use Symfony\Component\HttpFoundation\Request;
class DefaultFormatTestController {
public function content(Request $request) {
$format = $request->getRequestFormat();
return new CacheableResponse('format:' . $format, 200, ['Content-Type' => $request->getMimeType($format)]);
}
}

View file

@ -0,0 +1,6 @@
name: 'Deprecation test'
type: module
description: 'Support module for testing deprecation behaviors.'
package: Testing
version: VERSION
core: 8.x

View file

@ -0,0 +1,34 @@
<?php
/**
* @file
* Contains functions for testing calling deprecated functions in tests.
*/
/**
* A deprecated function.
*
* @return string
* A known return value of 'known_return_value'.
*
* @deprecated in Drupal 8.4.x. Might be removed before Drupal 9.0.0. This is
* the deprecation message for deprecated_test_function().
*/
function deprecation_test_function() {
@trigger_error('This is the deprecation message for deprecation_test_function().', E_USER_DEPRECATED);
return 'known_return_value';
}
/**
* Implements hook_deprecated_hook().
*/
function deprecation_test_deprecated_hook($arg) {
return $arg;
}
/**
* Implements hook_deprecated_alter_alter().
*/
function deprecation_test_deprecated_alter_alter(&$data, $context1, $context2) {
$data = [$context1, $context2];
}

View file

@ -0,0 +1,6 @@
deprecation_test.route:
path: '/this-calls-a-deprecated-method'
defaults:
_controller: \Drupal\deprecation_test\DeprecatedController::deprecatedMethod
requirements:
_access: 'TRUE'

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\deprecation_test;
/**
* Defines a controller that calls a deprecated method.
*/
class DeprecatedController {
/**
* Controller callback.
*
* @return array
* Render array.
*/
public function deprecatedMethod() {
return [
'#markup' => deprecation_test_function(),
];
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace Drupal\deprecation_test\Deprecation;
@trigger_error(__NAMESPACE__ . '\DrupalStandardsListenerDeprecatedClass is deprecated.', E_USER_DEPRECATED);
/**
* Fixture class for use by DrupalStandardsListenerDeprecationTest.
*
* This class is arbitrarily deprecated in order to test the deprecation error
* handling properties of DrupalStandardsListener.
*
* @see \Drupal\Tests\Core\Listeners\DrupalStandardsListenerDeprecationTest
* @see \Drupal\Tests\Listeners\DrupalStandardsListener::endTest()
*/
class DrupalStandardsListenerDeprecatedClass {
/**
* Returns a known value.
*
* @return string
* A known return value.
*/
public function testFunction() {
return 'test';
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace Drupal\deprecation_test\Deprecation;
@trigger_error(__NAMESPACE__ . '\FixtureDeprecatedClass is deprecated.', E_USER_DEPRECATED);
/**
* Fixture class for use by DrupalStandardsListenerDeprecationTest.
*
* This class is arbitrarily deprecated in order to test the deprecation error
* handling properties of DrupalStandardsListener.
*
* @see \Drupal\Tests\Core\Listeners\DrupalStandardsListenerDeprecationTest
* @see \Drupal\Tests\Listeners\DrupalStandardsListener::endTest()
*/
class FixtureDeprecatedClass {
/**
* Returns a known value.
*
* @return string
* A known return value.
*/
public function testFunction() {
return 'test';
}
}

View file

@ -0,0 +1,6 @@
name: 'Dialog Renderer Test'
type: module
description: 'Support module for Dialog Renderer tests.'
core: 8.x
package: Testing
version: VERSION

View file

@ -0,0 +1,15 @@
dialog_renderer_test.links:
path: '/dialog_renderer-test-links'
defaults:
_controller: '\Drupal\dialog_renderer_test\Controller\TestController::linksDisplay'
_title: 'Links'
requirements:
_access: 'TRUE'
dialog_renderer_test.modal_content:
path: '/dialog_renderer-content'
defaults:
_controller: '\Drupal\dialog_renderer_test\Controller\TestController::modalContent'
_title: 'Thing 1'
requirements:
_access: 'TRUE'

View file

@ -0,0 +1,13 @@
services:
# Provide 2 main content renderer services that use the same class but
# behave differently depending on the 2nd argument.
main_content_renderer.wide_modal:
class: Drupal\dialog_renderer_test\Render\MainContent\WideModalRenderer
arguments: ['@title_resolver', 'wide']
tags:
- { name: render.main_content_renderer, format: drupal_modal.wide }
main_content_renderer.extra_wide_modal:
class: Drupal\dialog_renderer_test\Render\MainContent\WideModalRenderer
arguments: ['@title_resolver', 'extra_wide']
tags:
- { name: render.main_content_renderer, format: drupal_modal.extra_wide }

View file

@ -0,0 +1,80 @@
<?php
namespace Drupal\dialog_renderer_test\Controller;
use Drupal\Core\Url;
/**
* Test controller display modal links and content.
*/
class TestController {
/**
* Return modal content.
*
* @return array
* Render array for display in modal.
*/
public function modalContent() {
return [
'#type' => 'markup',
'#markup' => 'Look at me in a modal!',
];
}
/**
* Displays test links that will open in the modal dialog.
*
* @return array
* Render array with links.
*/
public function linksDisplay() {
return [
'normal_modal' => [
'#title' => 'Normal Modal!',
'#type' => 'link',
'#url' => Url::fromRoute('dialog_renderer_test.modal_content'),
'#attributes' => [
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
],
'#attached' => [
'library' => [
'core/drupal.ajax',
],
],
],
'wide_modal' => [
'#title' => 'Wide Modal!',
'#type' => 'link',
'#url' => Url::fromRoute('dialog_renderer_test.modal_content'),
'#attributes' => [
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-renderer' => 'wide',
],
'#attached' => [
'library' => [
'core/drupal.ajax',
],
],
],
'extra_wide_modal' => [
'#title' => 'Extra Wide Modal!',
'#type' => 'link',
'#url' => Url::fromRoute('dialog_renderer_test.modal_content'),
'#attributes' => [
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-renderer' => 'extra_wide',
],
'#attached' => [
'library' => [
'core/drupal.ajax',
],
],
],
];
}
}

View file

@ -0,0 +1,76 @@
<?php
namespace Drupal\dialog_renderer_test\Render\MainContent;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Controller\TitleResolverInterface;
use Drupal\Core\Render\MainContent\ModalRenderer;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Default main content renderer for wide modal dialog requests.
*
* This test class is copied from \Drupal\Core\Render\MainContent\ModalRenderer
* to demonstrate selecting a different render via 'data-dialog-renderer' link
* attribute.
*/
class WideModalRenderer extends ModalRenderer {
/**
* The mode, either 'wide' or 'extra_wide'.
*
* @var string
*/
protected $mode;
/**
* Constructs a new WideModalRenderer.
*
* @param \Drupal\Core\Controller\TitleResolverInterface $title_resolver
* The title resolver.
* @param string $mode
* The mode, either 'wide' or 'extra_wide'.
*/
public function __construct(TitleResolverInterface $title_resolver, $mode = 'wide') {
parent::__construct($title_resolver);
$this->mode = $mode;
}
/**
* {@inheritdoc}
*/
public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) {
$response = new AjaxResponse();
// First render the main content, because it might provide a title.
$content = drupal_render_root($main_content);
// Attach the library necessary for using the OpenModalDialogCommand and set
// the attachments for this Ajax response.
$main_content['#attached']['library'][] = 'core/drupal.dialog.ajax';
$response->setAttachments($main_content['#attached']);
// If the main content doesn't provide a title, use the title resolver.
$title = isset($main_content['#title']) ? $main_content['#title'] : $this->titleResolver->getTitle($request, $route_match->getRouteObject());
// Determine the title: use the title provided by the main content if any,
// otherwise get it from the routing information.
$options = $request->request->get('dialogOptions', []);
// Override width option.
switch ($this->mode) {
case 'wide':
$options['width'] = 700;
break;
case 'extra_wide':
$options['width'] = 1000;
break;
}
$response->addCommand(new OpenModalDialogCommand($title, $content, $options));
return $response;
}
}

View file

@ -62,7 +62,8 @@ class EarlyRenderingTestController extends ControllerBase {
'#pre_render' => [function () {
$elements = $this->earlyRenderContent();
return $elements;
}],
},
],
];
}

View file

@ -2,4 +2,4 @@
namespace Drupal\early_rendering_controller_test;
class TestDomainObject { }
class TestDomainObject {}

View file

@ -5,7 +5,7 @@ core: 8.x
package: Testing
version: VERSION
dependencies:
- node
- user
- views
- entity_test
- drupal:node
- drupal:user
- drupal:views
- drupal:entity_test

View file

@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- drupal:views

View file

@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- entity_test
- drupal:entity_test

View file

@ -94,5 +94,6 @@ function entity_schema_test_entity_bundle_delete($entity_type_id, $bundle) {
->setTargetBundle($bundle);
// Notify the entity storage that our field is gone.
\Drupal::entityManager()->onFieldDefinitionDelete($field_definitions['custom_bundle_field']);
\Drupal::entityManager()->onFieldStorageDefinitionDelete($field_definitions['custom_bundle_field']);
}
}

View file

@ -0,0 +1,5 @@
# Schema for the configuration of the 'internal property test' field type.
field.storage_settings.internal_property_test:
type: field.storage_settings.string
label: 'Internal property settings'

View file

@ -5,5 +5,5 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- field
- text
- drupal:field
- drupal:text

View file

@ -6,6 +6,7 @@
*/
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
@ -93,24 +94,16 @@ function entity_test_entity_type_alter(array &$entity_types) {
}
}
// Allow entity_test_with_bundle tests to override the entity type definition.
$entity_types['entity_test_with_bundle'] = $state->get('entity_test_with_bundle.entity_type', $entity_types['entity_test_with_bundle']);
// Allow entity_test_rev tests to override the entity type definition.
$entity_types['entity_test_rev'] = $state->get('entity_test_rev.entity_type', $entity_types['entity_test_rev']);
// Enable the entity_test_new only when needed.
if (!$state->get('entity_test_new')) {
unset($entity_types['entity_test_new']);
}
}
/**
* Implements hook_module_implements_alter().
*/
function entity_test_module_implements_alter(&$implementations, $hook) {
// Move our hook_entity_type_alter() implementation to the beginning of the
// list in order to run before content_moderation_entity_type_alter().
if ($hook === 'entity_type_alter') {
$implementations = ['entity_test' => $implementations['entity_test']] + $implementations;
}
$entity_test_definition = $entity_types['entity_test'];
$entity_test_definition->set('entity_keys', $state->get('entity_test.entity_keys', []) + $entity_test_definition->getKeys());
}
/**
@ -119,6 +112,28 @@ function entity_test_module_implements_alter(&$implementations, $hook) {
function entity_test_entity_base_field_info(EntityTypeInterface $entity_type) {
$fields = [];
if ($entity_type->id() === 'entity_test' && \Drupal::state()->get('entity_test.internal_field')) {
$fields['internal_string_field'] = BaseFieldDefinition::create('string')
->setLabel('Internal field')
->setInternal(TRUE);
}
if ($entity_type->id() === 'entity_test_mul' && \Drupal::state()->get('entity_test.required_default_field')) {
$fields['required_default_field'] = BaseFieldDefinition::create('string')
->setLabel('Required field with default value')
->setRequired(TRUE)
->setDefaultValue('this is a default value');
}
if ($entity_type->id() === 'entity_test_mul' && \Drupal::state()->get('entity_test.required_multi_default_field')) {
$fields['required_multi_default_field'] = BaseFieldDefinition::create('string')
->setLabel('Required field with default value')
->setRequired(TRUE)
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
->setDefaultValue([
['value' => 'this is the first default field item'],
['value' => 'this is the second default value'],
['value' => 'you get the idea...'],
]);
}
if ($entity_type->id() == 'entity_test_mulrev' && \Drupal::state()->get('entity_test.field_test_item')) {
$fields['field_test_item'] = BaseFieldDefinition::create('field_test')
->setLabel(t('Field test'))
@ -160,15 +175,6 @@ function entity_test_entity_base_field_info_alter(&$fields, EntityTypeInterface
}
}
/**
* Implements hook_entity_field_storage_info().
*/
function entity_test_entity_field_storage_info(EntityTypeInterface $entity_type) {
if ($entity_type->id() == 'entity_test_update') {
return \Drupal::state()->get('entity_test_update.additional_field_storage_definitions', []);
}
}
/**
* Creates a new bundle for entity_test entities.
*
@ -220,6 +226,26 @@ function entity_test_entity_bundle_info() {
return $bundles;
}
/**
* Implements hook_entity_bundle_info_alter().
*/
function entity_test_entity_bundle_info_alter(&$bundles) {
$entity_info = \Drupal::entityTypeManager()->getDefinitions();
$state = \Drupal::state();
foreach ($bundles as $entity_type_id => &$all_bundle_info) {
if ($entity_info[$entity_type_id]->getProvider() == 'entity_test') {
if ($state->get('entity_test.translation')) {
foreach ($all_bundle_info as $bundle_name => &$bundle_info) {
$bundle_info['translatable'] = TRUE;
if ($state->get('entity_test.untranslatable_fields.default_translation_affected')) {
$bundle_info['untranslatable_fields.default_translation_affected'] = TRUE;
}
}
}
}
}
}
/**
* Implements hook_entity_view_mode_info_alter().
*/
@ -280,7 +306,7 @@ function entity_test_entity_extra_field_info() {
'description' => t('An extra field on the display side, hidden by default.'),
'visible' => FALSE,
],
]
],
];
return $extra;
@ -654,6 +680,23 @@ function entity_test_entity_test_mul_langcode_key_translation_delete(EntityInter
_entity_test_record_hooks('entity_test_mul_langcode_key_translation_delete', $translation->language()->getId());
}
/**
* Implements hook_entity_revision_create().
*/
function entity_test_entity_revision_create(EntityInterface $new_revision, EntityInterface $entity, $keep_untranslatable_fields) {
_entity_test_record_hooks('entity_revision_create', ['new_revision' => $new_revision, 'entity' => $entity, 'keep_untranslatable_fields' => $keep_untranslatable_fields]);
}
/**
* Implements hook_ENTITY_TYPE_revision_create() for 'entity_test_mulrev'.
*/
function entity_test_entity_test_mulrev_revision_create(EntityInterface $new_revision, EntityInterface $entity, $keep_untranslatable_fields) {
if ($new_revision->get('name')->value == 'revision_create_test_it') {
$new_revision->set('name', 'revision_create_test_it_altered');
}
_entity_test_record_hooks('entity_test_mulrev_revision_create', ['new_revision' => $new_revision, 'entity' => $entity, 'keep_untranslatable_fields' => $keep_untranslatable_fields]);
}
/**
* Field default value callback.
*
@ -756,6 +799,16 @@ function entity_test_entity_access(EntityInterface $entity, $operation, AccountI
return AccessResult::allowed();
}
// Create specific labels to allow or deny access based on certain test
// conditions.
// @see \Drupal\KernelTests\Core\Entity\EntityAccessControlHandlerTest
if ($entity->label() == 'Accessible') {
return AccessResult::allowed();
}
if ($entity->label() == 'Inaccessible') {
return AccessResult::forbidden();
}
// Uncacheable because the access result depends on a State key-value pair and
// might therefore change at any time.
$condition = \Drupal::state()->get("entity_test_entity_access.{$operation}." . $entity->id(), FALSE);
@ -792,3 +845,17 @@ function entity_test_entity_test_create_access(AccountInterface $account, $conte
// No opinion.
return AccessResult::neutral();
}
/**
* Implements hook_query_entity_test_access_alter().
*/
function entity_test_query_entity_test_access_alter(AlterableInterface $query) {
if (!\Drupal::state()->get('entity_test_query_access')) {
return;
}
/** @var \Drupal\Core\Database\Query\Select|\Drupal\Core\Database\Query\AlterableInterface $query */
if (!\Drupal::currentUser()->hasPermission('view all entity_test_query_access entities')) {
$query->condition('entity_test_query_access.name', 'published entity');
}
}

View file

@ -12,6 +12,8 @@ administer entity_test_with_bundle content:
description: 'administer entity_test_with_bundle content'
administer entity_test_bundle content:
title: 'administer entity_test_bundle content'
view all entity_test_query_access entities:
title: 'view all entity_test_query_access entities'
permission_callbacks:
- \Drupal\entity_test\EntityTestPermissions::entityTestBundlePermissions

View file

@ -95,7 +95,6 @@ class EntityTestController extends ControllerBase {
];
}
/**
* Empty list of entities of the given entity type.
*

View file

@ -48,6 +48,9 @@ use Drupal\user\UserInterface;
* },
* field_ui_base_route = "entity.entity_test.admin_form",
* )
*
* Note that this entity type annotation intentionally omits the "create" link
* template. See https://www.drupal.org/node/2293697.
*/
class EntityTest extends ContentEntityBase implements EntityOwnerInterface {
@ -106,7 +109,7 @@ class EntityTest extends ContentEntityBase implements EntityOwnerInterface {
],
]);
return $fields;
return $fields + \Drupal::state()->get($entity_type->id() . '.additional_base_field_definitions', []);
}
/**
@ -161,4 +164,15 @@ class EntityTest extends ContentEntityBase implements EntityOwnerInterface {
return $this->get('name')->value;
}
/**
* {@inheritdoc}
*/
public function getEntityKey($key) {
// Typically this protected method is used internally by entity classes and
// exposed publicly through more specific getter methods. So that test cases
// are able to set and access entity keys dynamically, update the visibility
// of this method to public.
return parent::getEntityKey($key);
}
}

View file

@ -1,6 +1,7 @@
<?php
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
/**

View file

@ -0,0 +1,52 @@
<?php
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList;
use Drupal\entity_test\Plugin\Field\ComputedTestFieldItemList;
/**
* An entity used for testing computed field values.
*
* @ContentEntityType(
* id = "entity_test_computed_field",
* label = @Translation("Entity Test computed field"),
* base_table = "entity_test_computed_field",
* handlers = {
* "views_data" = "Drupal\entity_test\EntityTestViewsData"
* },
* entity_keys = {
* "id" = "id",
* "label" = "name",
* },
* admin_permission = "administer entity_test content",
* links = {
* "add-form" = "/entity_test_computed_field/add",
* },
* )
*/
class EntityTestComputedField extends EntityTest {
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['computed_string_field'] = BaseFieldDefinition::create('string')
->setLabel('Computed Field Test')
->setComputed(TRUE)
->setClass(ComputedTestFieldItemList::class);
$fields['computed_reference_field'] = BaseFieldDefinition::create('entity_reference')
->setLabel('Computed Reference Field Test')
->setComputed(TRUE)
->setSetting('target_type', 'entity_test')
->setClass(ComputedReferenceTestFieldItemList::class);
return $fields;
}
}

View file

@ -3,6 +3,7 @@
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines the test entity class for testing entity constraint violations.
@ -39,6 +40,16 @@ class EntityTestConstraintViolation extends EntityTest {
]);
$fields['name']->addConstraint('FieldWidgetConstraint', []);
// Add a field that uses a widget with a custom implementation for
// \Drupal\Core\Field\WidgetInterface::errorElement().
$fields['test_field'] = BaseFieldDefinition::create('integer')
->setLabel(t('Test field'))
->setDisplayOptions('form', [
'type' => 'number',
'weight' => 1,
])
->addConstraint('FieldWidgetConstraint', []);
return $fields;
}

View file

@ -0,0 +1,39 @@
<?php
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* An entity used for testing map base field values.
*
* @ContentEntityType(
* id = "entity_test_map_field",
* label = @Translation("Entity Test map field"),
* base_table = "entity_test_map_field",
* entity_keys = {
* "uuid" = "uuid",
* "id" = "id",
* "label" = "name",
* "langcode" = "langcode",
* },
* admin_permission = "administer entity_test content",
* )
*/
class EntityTestMapField extends EntityTest {
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['data'] = BaseFieldDefinition::create('map')
->setLabel(t('Data'))
->setDescription(t('A serialized array of additional data.'));
return $fields;
}
}

View file

@ -2,6 +2,8 @@
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Defines the test entity class.
*
@ -44,4 +46,11 @@ namespace Drupal\entity_test\Entity;
*/
class EntityTestMul extends EntityTest {
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
return parent::baseFieldDefinitions($entity_type);
}
}

View file

@ -2,6 +2,9 @@
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines the test entity class.
*
@ -47,4 +50,18 @@ namespace Drupal\entity_test\Entity;
*/
class EntityTestMulRev extends EntityTestRev {
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['non_mul_field'] = BaseFieldDefinition::create('string')
->setLabel(t('Non translatable'))
->setDescription(t('A non-translatable string field'))
->setRevisionable(TRUE);
return $fields;
}
}

View file

@ -71,6 +71,7 @@ class EntityTestMulRevChanged extends EntityTestMulChanged {
$fields['name']->setRevisionable(TRUE);
$fields['user_id']->setRevisionable(TRUE);
$fields['changed']->setRevisionable(TRUE);
$fields['not_translatable']->setRevisionable(TRUE);
return $fields;
}

View file

@ -17,7 +17,8 @@ use Drupal\Core\Entity\EntityTypeInterface;
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
* "form" = {
* "default" = "Drupal\entity_test\EntityTestForm",
* "delete" = "Drupal\entity_test\EntityTestDeleteForm"
* "delete" = "Drupal\entity_test\EntityTestDeleteForm",
* "delete-multiple-confirm" = "Drupal\Core\Entity\Form\DeleteMultipleForm"
* },
* "translation" = "Drupal\content_translation\ContentTranslationHandler",
* "views_data" = "Drupal\views\EntityViewsData",
@ -45,6 +46,7 @@ use Drupal\Core\Entity\EntityTypeInterface;
* "add-form" = "/entity_test_mulrevpub/add",
* "canonical" = "/entity_test_mulrevpub/manage/{entity_test_mulrevpub}",
* "delete-form" = "/entity_test/delete/entity_test_mulrevpub/{entity_test_mulrevpub}",
* "delete-multiple-form" = "/entity_test/delete",
* "edit-form" = "/entity_test_mulrevpub/manage/{entity_test_mulrevpub}/edit",
* "revision" = "/entity_test_mulrevpub/{entity_test_mulrevpub}/revision/{entity_test_mulrevpub_revision}/view",
* }

View file

@ -9,6 +9,9 @@ namespace Drupal\entity_test\Entity;
* id = "entity_test_no_bundle",
* label = @Translation("Entity Test without bundle"),
* base_table = "entity_test_no_bundle",
* handlers = {
* "views_data" = "Drupal\views\EntityViewsData"
* },
* entity_keys = {
* "id" = "id",
* "revision" = "revision_id",

View file

@ -8,12 +8,17 @@ namespace Drupal\entity_test\Entity;
* @ContentEntityType(
* id = "entity_test_no_label",
* label = @Translation("Entity Test without label"),
* internal = TRUE,
* persistent_cache = FALSE,
* base_table = "entity_test_no_label",
* handlers = {
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
* },
* entity_keys = {
* "id" = "id",
* "bundle" = "type"
* }
* "uuid" = "uuid",
* "bundle" = "type",
* },
* )
*/
class EntityTestNoLabel extends EntityTest {

View file

@ -0,0 +1,29 @@
<?php
namespace Drupal\entity_test\Entity;
/**
* Test entity class with revisions but without UUIDs.
*
* @ContentEntityType(
* id = "entity_test_no_uuid",
* label = @Translation("Test entity without UUID"),
* handlers = {
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
* },
* base_table = "entity_test_no_uuid",
* revision_table = "entity_test_no_uuid_revision",
* admin_permission = "administer entity_test content",
* persistent_cache = FALSE,
* entity_keys = {
* "id" = "id",
* "revision" = "vid",
* "bundle" = "type",
* "label" = "name",
* "langcode" = "langcode",
* },
* )
*/
class EntityTestNoUuid extends EntityTest {
}

View file

@ -16,7 +16,8 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
* "form" = {
* "default" = "Drupal\entity_test\EntityTestForm",
* "delete" = "Drupal\entity_test\EntityTestDeleteForm"
* "delete" = "Drupal\entity_test\EntityTestDeleteForm",
* "delete-multiple-confirm" = "Drupal\Core\Entity\Form\DeleteMultipleForm"
* },
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
* "translation" = "Drupal\content_translation\ContentTranslationHandler",
@ -41,6 +42,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "add-form" = "/entity_test_rev/add",
* "canonical" = "/entity_test_rev/manage/{entity_test_rev}",
* "delete-form" = "/entity_test/delete/entity_test_rev/{entity_test_rev}",
* "delete-multiple-form" = "/entity_test_rev/delete_multiple",
* "edit-form" = "/entity_test_rev/manage/{entity_test_rev}/edit",
* "revision" = "/entity_test_rev/{entity_test_rev}/revision/{entity_test_rev_revision}/view",
* }

View file

@ -1,6 +1,7 @@
<?php
namespace Drupal\entity_test\Entity;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityTypeInterface;

View file

@ -1,51 +0,0 @@
<?php
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Defines the test entity class for testing definition updates.
*
* This entity type starts out non-revisionable by lacking a "revision_id" key,
* but during an update test, can be made revisionable by adding that key.
*
* @ContentEntityType(
* id = "entity_test_update",
* label = @Translation("Test entity update"),
* handlers = {
* "storage_schema" = "Drupal\entity_test\EntityTestStorageSchema"
* },
* base_table = "entity_test_update",
* revision_table = "entity_test_update_revision",
* persistent_cache = FALSE,
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "bundle" = "type",
* "label" = "name",
* "langcode" = "langcode",
* }
* )
*/
class EntityTestUpdate extends EntityTestRev {
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields += \Drupal::state()->get('entity_test_update.additional_base_field_definitions', []);
return $fields;
}
/**
* {@inheritdoc}
*/
public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
$fields = parent::bundleFieldDefinitions($entity_type, $bundle, $base_field_definitions);
$fields += \Drupal::state()->get('entity_test_update.additional_bundle_field_definitions.' . $bundle, []);
return $fields;
}
}

View file

@ -41,6 +41,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* "add-form" = "/entity_test_with_bundle/add/{entity_test_bundle}",
* "edit-form" = "/entity_test_with_bundle/{entity_test_with_bundle}/edit",
* "delete-form" = "/entity_test_with_bundle/{entity_test_with_bundle}/delete",
* "create" = "/entity_test_with_bundle",
* },
* )
*/

View file

@ -1,48 +0,0 @@
<?php
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\RevisionableContentEntityBase;
/**
* Defines the test entity class.
*
* @ContentEntityType(
* id = "entity_test_revlog",
* label = @Translation("Test entity - revisions log"),
* handlers = {
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
* "form" = {
* "default" = "Drupal\entity_test\EntityTestForm",
* "delete" = "Drupal\entity_test\EntityTestDeleteForm"
* },
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
* "translation" = "Drupal\content_translation\ContentTranslationHandler",
* "views_data" = "Drupal\views\EntityViewsData",
* "route_provider" = {
* "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
* },
* },
* base_table = "entity_test_revlog",
* revision_table = "entity_test_revlog_revision",
* admin_permission = "administer entity_test content",
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "revision" = "revision_id",
* "bundle" = "type",
* "label" = "name",
* "langcode" = "langcode",
* },
* links = {
* "canonical" = "/entity_test_revlog/manage/{entity_test_revlog}",
* "delete-form" = "/entity_test/delete/entity_test_revlog/{entity_test_revlog}",
* "edit-form" = "/entity_test_revlog/manage/{entity_test_revlog}/edit",
* "revision" = "/entity_test_revlog/{entity_test_revlog}/revision/{entity_test_revlog_revision}/view",
* }
* )
*/
class EntityTestWithRevisionLog extends RevisionableContentEntityBase {
}

View file

@ -36,7 +36,7 @@ class EntityTestAccessControlHandler extends EntityAccessControlHandler {
/** @var \Drupal\entity_test\Entity\EntityTest $entity */
// Always forbid access to entities with the label 'forbid_access', used for
// \Drupal\system\Tests\Entity\EntityAccessHControlandlerTest::testDefaultEntityAccess().
// \Drupal\system\Tests\Entity\EntityAccessControlHandlerTest::testDefaultEntityAccess().
if ($entity->label() == 'forbid_access') {
return AccessResult::forbidden();
}

Some files were not shown because too many files have changed in this diff Show more