upgrades core to 8.4.2
This commit is contained in:
@@ -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());
|
||||
|
||||
Vendored
+162
@@ -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();
|
||||
Vendored
+36
@@ -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();
|
||||
Vendored
+35
@@ -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();
|
||||
}
|
||||
Vendored
+435
@@ -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: { }
|
||||
+436
@@ -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: { }
|
||||
+3
-3
@@ -4,8 +4,8 @@ type: module
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ description: 'Test for AJAX form calls.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -30,3 +30,19 @@ 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'
|
||||
|
||||
|
||||
@@ -22,6 +22,28 @@ class Callbacks {
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback triggered by date.
|
||||
*/
|
||||
public function dateCallback($form, FormStateInterface $form_state) {
|
||||
$response = new AjaxResponse();
|
||||
$response->addCommand(new HtmlCommand('#ajax_date_value', $form_state->getValue('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', $datetime));
|
||||
$response->addCommand(new DataCommand('#ajax_datetime_value', 'form_state_value_datetime', $datetime));
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback triggered by checkbox.
|
||||
*/
|
||||
@@ -32,6 +54,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.
|
||||
*/
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?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.
|
||||
*/
|
||||
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) {}
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?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.
|
||||
*/
|
||||
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.
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -31,7 +31,8 @@ class AjaxFormsTestSimpleForm extends FormBase {
|
||||
'#options' => [
|
||||
'red' => 'red',
|
||||
'green' => 'green',
|
||||
'blue' => 'blue'],
|
||||
'blue' => 'blue',
|
||||
],
|
||||
'#ajax' => [
|
||||
'callback' => [$object, 'selectCallback'],
|
||||
],
|
||||
|
||||
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- contact
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -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.
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ description: 'Support module for Database layer tests.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -207,7 +207,8 @@ function database_test_schema() {
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => FALSE,
|
||||
'default' => 0],
|
||||
'default' => 0,
|
||||
],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
|
||||
+2
-2
@@ -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');
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
name: 'Deprecation test'
|
||||
type: module
|
||||
description: 'Support module for testing deprecation behaviors.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1509719929
|
||||
+28
@@ -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';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
name: 'Dialog Renderer Test'
|
||||
type: module
|
||||
description: 'Support module for Dialog Renderer tests.'
|
||||
# core: 8.x
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1509719929
|
||||
+15
@@ -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'
|
||||
+13
@@ -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 }
|
||||
+80
@@ -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',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+2
-1
@@ -62,7 +62,8 @@ class EarlyRenderingTestController extends ControllerBase {
|
||||
'#pre_render' => [function () {
|
||||
$elements = $this->earlyRenderContent();
|
||||
return $elements;
|
||||
}],
|
||||
}
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
namespace Drupal\early_rendering_controller_test;
|
||||
|
||||
class TestDomainObject { }
|
||||
class TestDomainObject {}
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ description: 'Support module for CRUD hook tests.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -10,8 +10,8 @@ dependencies:
|
||||
- views
|
||||
- entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- views
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -8,8 +8,8 @@ dependencies:
|
||||
- field
|
||||
- text
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -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,8 +94,8 @@ 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')) {
|
||||
@@ -102,17 +103,6 @@ function entity_test_entity_type_alter(array &$entity_types) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
@@ -793,3 +783,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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\entity_test\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\entity_test\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
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);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\entity_test\Entity;
|
||||
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
||||
|
||||
@@ -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",
|
||||
* },
|
||||
* )
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,17 @@ class EntityTestViewsData extends EntityViewsData {
|
||||
public function getViewsData() {
|
||||
$views_data = parent::getViewsData();
|
||||
|
||||
if ($this->entityType->id() === 'entity_test_computed_field') {
|
||||
$views_data['entity_test_computed_field']['computed_string_field'] = [
|
||||
'title' => $this->t('Computed String Field'),
|
||||
'field' => [
|
||||
'id' => 'field',
|
||||
'default_formatter' => 'string',
|
||||
'field_name' => 'computed_string_field',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->entityType->id() != 'entity_test') {
|
||||
return $views_data;
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\entity_test\Plugin\Field;
|
||||
|
||||
use Drupal\Core\Field\FieldItemList;
|
||||
|
||||
/**
|
||||
* A computed field item list.
|
||||
*/
|
||||
class ComputedTestFieldItemList extends FieldItemList {
|
||||
|
||||
/**
|
||||
* Compute the list property from state.
|
||||
*/
|
||||
protected function computedListProperty() {
|
||||
foreach (\Drupal::state()->get('entity_test_computed_field_item_list_value', []) as $delta => $item) {
|
||||
$this->list[$delta] = $this->createItem($delta, $item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($index) {
|
||||
$this->computedListProperty();
|
||||
return isset($this->list[$index]) ? $this->list[$index] : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator() {
|
||||
$this->computedListProperty();
|
||||
return parent::getIterator();
|
||||
}
|
||||
|
||||
}
|
||||
+8
-1
@@ -31,7 +31,14 @@ class ChangedTestItem extends ChangedItem {
|
||||
// During a test the request time is immutable. To allow tests of the
|
||||
// algorithm of
|
||||
// Drupal\Core\Field\Plugin\Field\FieldType\ChangedItem::preSave() we need
|
||||
// to set a real time value here.
|
||||
// to set a real time value here. For the stability of the test, set the
|
||||
// time of the original language to the current time plus just over one
|
||||
// second to simulate two different request times.
|
||||
// @todo mock the time service in https://www.drupal.org/node/2908210.
|
||||
if ($this->getEntity()->language()->isDefault()) {
|
||||
// Wait 1.1 seconds because time_sleep_until() is not reliable.
|
||||
time_sleep_until(time() + 1.1);
|
||||
}
|
||||
$this->value = time();
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ use Drupal\Core\TypedData\DataDefinition;
|
||||
use Drupal\Core\TypedData\DataDefinitionInterface;
|
||||
use Drupal\Core\TypedData\TypedDataInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the 'field_test' entity field type.
|
||||
*
|
||||
|
||||
+5
@@ -25,6 +25,11 @@ class EntityTestEntityLevelValidator extends ConstraintValidator {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->addViolation();
|
||||
}
|
||||
if ($value->name->value === 'entity-level-violation-with-path') {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->atPath('test.form.element')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
name: 'Entity test revision log'
|
||||
type: module
|
||||
description: 'Provides two entity types with revision logging capabilities.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1509719929
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\entity_test_revlog\Entity;
|
||||
|
||||
/**
|
||||
* Defines the test entity class.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "entity_test_mul_revlog",
|
||||
* label = @Translation("Test entity - data table, revisions log"),
|
||||
* base_table = "entity_test_mul_revlog",
|
||||
* data_table = "entity_test_mul_revlog_field_data",
|
||||
* revision_table = "entity_test_mul_revlog_revision",
|
||||
* revision_data_table = "entity_test_mul_revlog_field_revision",
|
||||
* translatable = TRUE,
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "uuid" = "uuid",
|
||||
* "revision" = "revision_id",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "langcode" = "langcode",
|
||||
* },
|
||||
* revision_metadata_keys = {
|
||||
* "revision_user" = "revision_user",
|
||||
* "revision_created" = "revision_created",
|
||||
* "revision_log_message" = "revision_log_message"
|
||||
* },
|
||||
* )
|
||||
*/
|
||||
class EntityTestMulWithRevisionLog extends EntityTestWithRevisionLog {
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\entity_test_revlog\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\RevisionableContentEntityBase;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
|
||||
/**
|
||||
* Defines the test entity class.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "entity_test_revlog",
|
||||
* label = @Translation("Test entity - revisions log"),
|
||||
* base_table = "entity_test_revlog",
|
||||
* revision_table = "entity_test_revlog_revision",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "uuid" = "uuid",
|
||||
* "revision" = "revision_id",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "langcode" = "langcode",
|
||||
* },
|
||||
* revision_metadata_keys = {
|
||||
* "revision_user" = "revision_user",
|
||||
* "revision_created" = "revision_created",
|
||||
* "revision_log_message" = "revision_log_message"
|
||||
* },
|
||||
* )
|
||||
*/
|
||||
class EntityTestWithRevisionLog extends RevisionableContentEntityBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
|
||||
$fields['name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Name'))
|
||||
->setDescription(t('The name of the test entity.'))
|
||||
->setTranslatable(TRUE)
|
||||
->setRevisionable(TRUE)
|
||||
->setSetting('max_length', 32)
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'hidden',
|
||||
'type' => 'string',
|
||||
'weight' => -5,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -5,
|
||||
]);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
name: 'Entity Schema Converter Test'
|
||||
type: module
|
||||
description: 'Provides testing for the entity schema converter.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
dependencies:
|
||||
- entity_test_update
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1509719929
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Post update functions for entity_test_schema_converter.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
||||
|
||||
/**
|
||||
* @addtogroup updates-8.4.x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Update entity_test_update to be revisionable.
|
||||
*/
|
||||
function entity_test_schema_converter_post_update_make_revisionable(&$sandbox) {
|
||||
$revisionableSchemaConverter = new SqlContentEntityStorageSchemaConverter(
|
||||
'entity_test_update',
|
||||
\Drupal::entityTypeManager(),
|
||||
\Drupal::entityDefinitionUpdateManager(),
|
||||
\Drupal::service('entity.last_installed_schema.repository'),
|
||||
\Drupal::keyValue('entity.storage_schema.sql'),
|
||||
\Drupal::database()
|
||||
);
|
||||
|
||||
$revisionableSchemaConverter->convertToRevisionable(
|
||||
$sandbox,
|
||||
[
|
||||
'test_single_property',
|
||||
'test_multiple_properties',
|
||||
'test_single_property_multiple_values',
|
||||
'test_multiple_properties_multiple_values',
|
||||
'test_entity_base_field_info',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-8.4.x".
|
||||
*/
|
||||
+3
-3
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the Entity Test Update module.
|
||||
*/
|
||||
|
||||
use Drupal\system\Tests\Update\DbUpdatesTrait;
|
||||
|
||||
DbUpdatesTrait::includeUpdates('entity_test_update', 'entity_rev_pub_updates');
|
||||
@@ -79,6 +79,11 @@ function entity_test_update_entity_presave(EntityInterface $entity) {
|
||||
* (e.g. content_translation_status);
|
||||
* - 52 more test entities (with the IDs 51 - 102) crated, translated and saved.
|
||||
*
|
||||
* The 'drupal-8.0.0-rc1-filled.standard.entity_test_update_mul_rev.php.gz' db
|
||||
* dump was created like the multilingual one described above, with one change:
|
||||
* The annotation of the entity_test_update entity type was also manually edited
|
||||
* in order to make it revisionable.
|
||||
*
|
||||
* @param int $start
|
||||
* (optional) The entity ID to start from. Defaults to 1.
|
||||
* @param int $end
|
||||
@@ -98,13 +103,15 @@ function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_tr
|
||||
'id' => $i,
|
||||
'name' => $i,
|
||||
'test_single_property' => $i . ' - test single property',
|
||||
'test_multiple_properties' => [[
|
||||
'value1' => $i . ' - test multiple properties - value1',
|
||||
'value2' => $i . ' - test multiple properties - value2',
|
||||
]],
|
||||
'test_multiple_properties' => [
|
||||
[
|
||||
'value1' => $i . ' - test multiple properties - value1',
|
||||
'value2' => $i . ' - test multiple properties - value2',
|
||||
],
|
||||
],
|
||||
'test_single_property_multiple_values' => [
|
||||
['value' => $i . ' - test single property multiple values 0'],
|
||||
['value' => $i . ' - test single property multiple values 1']
|
||||
['value' => $i . ' - test single property multiple values 1'],
|
||||
],
|
||||
'test_multiple_properties_multiple_values' => [
|
||||
[
|
||||
@@ -114,7 +121,7 @@ function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_tr
|
||||
[
|
||||
'value1' => $i . ' - test multiple properties multiple values - value1 1',
|
||||
'value2' => $i . ' - test multiple properties multiple values - value2 1',
|
||||
]
|
||||
],
|
||||
],
|
||||
'test_non_rev_field' => $i . ' - test non-revisionable field',
|
||||
'test_non_mul_field' => $i . ' - test non-translatable field',
|
||||
@@ -127,7 +134,7 @@ function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_tr
|
||||
[
|
||||
'value1' => $i . ' - field test configurable field - value1 1',
|
||||
'value2' => $i . ' - field test configurable field - value2 1',
|
||||
]
|
||||
],
|
||||
],
|
||||
'test_entity_base_field_info' => $i . ' - test entity base field info',
|
||||
]);
|
||||
@@ -136,13 +143,15 @@ function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_tr
|
||||
$entity->addTranslation('ro', [
|
||||
'name' => $i . ' - ro',
|
||||
'test_single_property' => $i . ' - test single property - ro',
|
||||
'test_multiple_properties' => [[
|
||||
'value1' => $i . ' - test multiple properties - value1 - ro',
|
||||
'value2' => $i . ' - test multiple properties - value2 - ro',
|
||||
]],
|
||||
'test_multiple_properties' => [
|
||||
[
|
||||
'value1' => $i . ' - test multiple properties - value1 - ro',
|
||||
'value2' => $i . ' - test multiple properties - value2 - ro',
|
||||
],
|
||||
],
|
||||
'test_single_property_multiple_values' => [
|
||||
['value' => $i . ' - test single property multiple values 0 - ro'],
|
||||
['value' => $i . ' - test single property multiple values 1 - ro']
|
||||
['value' => $i . ' - test single property multiple values 1 - ro'],
|
||||
],
|
||||
'test_multiple_properties_multiple_values' => [
|
||||
[
|
||||
@@ -152,7 +161,7 @@ function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_tr
|
||||
[
|
||||
'value1' => $i . ' - test multiple properties multiple values - value1 1 - ro',
|
||||
'value2' => $i . ' - test multiple properties multiple values - value2 1 - ro',
|
||||
]
|
||||
],
|
||||
],
|
||||
'test_non_rev_field' => $i . ' - test non-revisionable field - ro',
|
||||
'field_test_configurable_field' => [
|
||||
@@ -163,7 +172,7 @@ function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_tr
|
||||
[
|
||||
'value1' => $i . ' - field test configurable field - value1 1 - ro',
|
||||
'value2' => $i . ' - field test configurable field - value2 1 - ro',
|
||||
]
|
||||
],
|
||||
],
|
||||
'test_entity_base_field_info' => $i . ' - test entity base field info - ro',
|
||||
]);
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Defines the 8400 db update for the "entity_rev_pub_updates" group.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
|
||||
/**
|
||||
* Implements hook_update_dependencies().
|
||||
*/
|
||||
function entity_test_update_update_dependencies() {
|
||||
// The update function that adds the status field must run after
|
||||
// content_translation_update_8400() which fixes NULL values for the
|
||||
// 'content_translation_status' field.
|
||||
$dependencies['entity_test_update'][8400] = [
|
||||
'content_translation' => 8400,
|
||||
];
|
||||
|
||||
return $dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the 'published' and revisionable metadata fields to entity_test_update.
|
||||
*/
|
||||
function entity_test_update_update_8400() {
|
||||
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
|
||||
|
||||
// Add the published entity key and revisionable metadata fields to the
|
||||
// entity_test_update entity type.
|
||||
$entity_type = $definition_update_manager->getEntityType('entity_test_update');
|
||||
|
||||
$entity_keys = $entity_type->getKeys();
|
||||
$entity_keys['published'] = 'status';
|
||||
$entity_type->set('entity_keys', $entity_keys);
|
||||
|
||||
$revision_metadata_keys = [
|
||||
'revision_user' => 'revision_user',
|
||||
'revision_created' => 'revision_created',
|
||||
'revision_log_message' => 'revision_log_message'
|
||||
];
|
||||
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
|
||||
|
||||
$definition_update_manager->updateEntityType($entity_type);
|
||||
|
||||
// Add the status field.
|
||||
$status = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
->setDescription(t('A boolean indicating the published state.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setTranslatable(TRUE)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
$has_content_translation_status_field = \Drupal::moduleHandler()->moduleExists('content_translation') && $definition_update_manager->getFieldStorageDefinition('content_translation_status', 'entity_test_update');
|
||||
if ($has_content_translation_status_field) {
|
||||
$status->setInitialValueFromField('content_translation_status');
|
||||
}
|
||||
else {
|
||||
$status->setInitialValue(TRUE);
|
||||
}
|
||||
$definition_update_manager->installFieldStorageDefinition('status', 'entity_test_update', 'entity_test_update', $status);
|
||||
|
||||
// Add the revision metadata fields.
|
||||
$revision_created = BaseFieldDefinition::create('created')
|
||||
->setLabel(t('Revision create time'))
|
||||
->setDescription(t('The time that the current revision was created.'))
|
||||
->setRevisionable(TRUE);
|
||||
$definition_update_manager->installFieldStorageDefinition('revision_created', 'entity_test_update', 'entity_test_update', $revision_created);
|
||||
|
||||
$revision_user = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Revision user'))
|
||||
->setDescription(t('The user ID of the author of the current revision.'))
|
||||
->setSetting('target_type', 'user')
|
||||
->setRevisionable(TRUE);
|
||||
$definition_update_manager->installFieldStorageDefinition('revision_user', 'entity_test_update', 'entity_test_update', $revision_user);
|
||||
|
||||
$revision_log_message = BaseFieldDefinition::create('string_long')
|
||||
->setLabel(t('Revision log message'))
|
||||
->setDescription(t('Briefly describe the changes you have made.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textarea',
|
||||
'weight' => 25,
|
||||
'settings' => [
|
||||
'rows' => 4,
|
||||
],
|
||||
]);
|
||||
$definition_update_manager->installFieldStorageDefinition('revision_log_message', 'entity_test_update', 'entity_test_update', $revision_log_message);
|
||||
|
||||
// Uninstall the 'content_translation_status' field if needed.
|
||||
$database = \Drupal::database();
|
||||
if ($has_content_translation_status_field) {
|
||||
// First we have to remove the field data.
|
||||
$database->update($entity_type->getDataTable())
|
||||
->fields(['content_translation_status' => NULL])
|
||||
->execute();
|
||||
|
||||
// A site may have disabled revisionability for this entity type.
|
||||
if ($entity_type->isRevisionable()) {
|
||||
$database->update($entity_type->getRevisionDataTable())
|
||||
->fields(['content_translation_status' => NULL])
|
||||
->execute();
|
||||
}
|
||||
|
||||
$content_translation_status = $definition_update_manager->getFieldStorageDefinition('content_translation_status', 'entity_test_update');
|
||||
$definition_update_manager->uninstallFieldStorageDefinition($content_translation_status);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -56,7 +56,7 @@ class ErrorTestController extends ControllerBase {
|
||||
* Generate fatals to test the error handler.
|
||||
*/
|
||||
public function generateFatals() {
|
||||
$function = function(array $test) {
|
||||
$function = function (array $test) {
|
||||
};
|
||||
|
||||
$function("test-string");
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@ dependencies:
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Core (Experimental)
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Core (Experimental)
|
||||
# version: 8.y.x-unstable
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
* Experimental Test module to test the Core (Experimental) package.
|
||||
*/
|
||||
|
||||
use \Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -294,6 +294,14 @@ form_test.checkboxes_radios:
|
||||
requirements:
|
||||
_access: 'TRUE'
|
||||
|
||||
form_test.radios_checked:
|
||||
path: '/form-test/radios-checked'
|
||||
defaults:
|
||||
_form: '\Drupal\form_test\Form\FormTestRadiosCheckedForm'
|
||||
_title: 'Radios checked defalt value'
|
||||
requirements:
|
||||
_access: 'TRUE'
|
||||
|
||||
form_test.email:
|
||||
path: '/form-test/email'
|
||||
defaults:
|
||||
|
||||
@@ -33,10 +33,29 @@ class FormTestInputForgeryForm extends FormBase {
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Submit'),
|
||||
];
|
||||
$form['#post_render'][] = [static::class, 'postRender'];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alters the rendered form to simulate input forgery.
|
||||
*
|
||||
* It's necessary to alter the rendered form here because Mink does not
|
||||
* support manipulating the DOM tree.
|
||||
*
|
||||
* @param string $rendered_form
|
||||
* The rendered form.
|
||||
*
|
||||
* @return string
|
||||
* The modified rendered form.
|
||||
*
|
||||
* @see \Drupal\Tests\system\Functional\Form\FormTest::testInputForgery()
|
||||
*/
|
||||
public static function postRender($rendered_form) {
|
||||
return str_replace('value="two"', 'value="FORGERY"', $rendered_form);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\form_test\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
/**
|
||||
* Form constructor to test #default_value settings of radios.
|
||||
*/
|
||||
class FormTestRadiosCheckedForm extends FormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'form_test_radios_checked';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form['radios'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
0 => 'Zero',
|
||||
'foo' => 'Foo',
|
||||
1 => 'One',
|
||||
'bar' => '<em>Bar - radios</em>',
|
||||
'>' => "<em>Special Char</em><script>alert('radios');</script>",
|
||||
],
|
||||
'#default_value' => 0,
|
||||
];
|
||||
$form['radios-string'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
0 => 'Zero',
|
||||
'foo' => 'Foo',
|
||||
1 => 'One',
|
||||
'bar' => '<em>Bar - radios</em>',
|
||||
'>' => "<em>Special Char</em><script>alert('radios');</script>",
|
||||
],
|
||||
'#default_value' => 'bar',
|
||||
];
|
||||
$form['radios-boolean-true'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
1 => 'True',
|
||||
0 => 'False',
|
||||
],
|
||||
'#default_value' => TRUE,
|
||||
];
|
||||
$form['radios-boolean-false'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
1 => 'True',
|
||||
0 => 'False',
|
||||
],
|
||||
'#default_value' => FALSE,
|
||||
];
|
||||
$form['radios-boolean-any'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
1 => 'True',
|
||||
0 => 'False',
|
||||
],
|
||||
'#default_value' => 'All',
|
||||
];
|
||||
$form['radios-string-zero'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
'0' => 'Zero',
|
||||
100 => 'One hundred',
|
||||
],
|
||||
'#default_value' => 0,
|
||||
];
|
||||
$form['radios-int-non-zero'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
0 => 'Zero',
|
||||
10 => 'Ten',
|
||||
100 => 'One hundred',
|
||||
],
|
||||
'#default_value' => 10,
|
||||
];
|
||||
$form['radios-int-non-zero-as-string'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
'0' => 'Zero',
|
||||
'10' => 'Ten',
|
||||
'100' => 'One hundred',
|
||||
],
|
||||
'#default_value' => '100',
|
||||
];
|
||||
$form['radios-empty-string'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
0 => 'None',
|
||||
],
|
||||
'#default_value' => '',
|
||||
];
|
||||
$form['radios-empty-array'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
0 => 'None',
|
||||
],
|
||||
'#default_value' => [],
|
||||
];
|
||||
$form['radios-key-FALSE'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => 'Radios',
|
||||
'#options' => [
|
||||
'All' => '- Any -',
|
||||
FALSE => 'False',
|
||||
],
|
||||
'#default_value' => '',
|
||||
];
|
||||
|
||||
$form['submit'] = ['#type' => 'submit', '#value' => 'Submit'];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$form_state->setResponse(new JsonResponse($form_state->getValues()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -115,6 +115,14 @@ class FormTestSelectForm extends FormBase {
|
||||
'#multiple' => TRUE,
|
||||
];
|
||||
|
||||
$form['opt_groups'] = [
|
||||
'#type' => 'select',
|
||||
'#options' => [
|
||||
'optgroup_one' => ['one' => 'one', 'two' => 'two', 'three' => 'three', 'four' => '<strong>four</strong>'],
|
||||
'optgroup_two' => ['five' => 'five', 'six' => 'six'],
|
||||
],
|
||||
];
|
||||
|
||||
$form['submit'] = ['#type' => 'submit', '#value' => 'Submit'];
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class FormTestStorageForm extends FormBase {
|
||||
// that issue.
|
||||
if ($this->getRequest()->get('immutable')) {
|
||||
$form_state->addBuildInfo('immutable', TRUE);
|
||||
if ($this->getRequest()->get('cache') && $this->getRequest()->isMethodSafe()) {
|
||||
if ($this->getRequest()->get('cache') && $this->getRequest()->isMethodCacheable()) {
|
||||
$form_state->setRequestMethod('FAKE');
|
||||
$form_state->setCached();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ namespace Drupal\image_test\Plugin\ImageToolkit;
|
||||
* title = @Translation("A dummy toolkit, derivative of 'test'.")
|
||||
* )
|
||||
*/
|
||||
class DerivedToolkit extends TestToolkit { }
|
||||
class DerivedToolkit extends TestToolkit {}
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@ namespace Drupal\image_test\Plugin\ImageToolkit\Operation\test;
|
||||
* description = @Translation("Bar.")
|
||||
* )
|
||||
*/
|
||||
class Bar extends OperationBase { }
|
||||
class Bar extends OperationBase {}
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@ namespace Drupal\image_test\Plugin\ImageToolkit\Operation\test;
|
||||
* description = @Translation("Foo.")
|
||||
* )
|
||||
*/
|
||||
class Foo extends OperationBase { }
|
||||
class Foo extends OperationBase {}
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@ namespace Drupal\image_test\Plugin\ImageToolkit\Operation\test;
|
||||
* description = @Translation("Foo derived.")
|
||||
* )
|
||||
*/
|
||||
class FooDerived extends OperationBase { }
|
||||
class FooDerived extends OperationBase {}
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @file
|
||||
* Testing behavior for JSWebAssertTest.
|
||||
*/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
/**
|
||||
* @type {Drupal~behavior}
|
||||
*
|
||||
* @prop {Drupal~behaviorAttach} attach
|
||||
* Makes changes in the DOM to be able to test the completion of AJAX in assertWaitOnAjaxRequest.
|
||||
*/
|
||||
Drupal.behaviors.js_webassert_test_wait_for_ajax_request = {
|
||||
attach(context) {
|
||||
$('input[name="test_assert_wait_on_ajax_input"]').val('js_webassert_test');
|
||||
},
|
||||
};
|
||||
}(jQuery, Drupal, drupalSettings));
|
||||
+7
-15
@@ -1,22 +1,14 @@
|
||||
/**
|
||||
* @file
|
||||
* Testing behavior for JSWebAssertTest.
|
||||
*/
|
||||
* DO NOT EDIT THIS FILE.
|
||||
* See the following change record for more information,
|
||||
* https://www.drupal.org/node/2815083
|
||||
* @preserve
|
||||
**/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @type {Drupal~behavior}
|
||||
*
|
||||
* @prop {Drupal~behaviorAttach} attach
|
||||
* Makes changes in the DOM to be able to test the completion of AJAX in assertWaitOnAjaxRequest.
|
||||
*/
|
||||
Drupal.behaviors.js_webassert_test_wait_for_ajax_request = {
|
||||
attach: function (context) {
|
||||
attach: function attach(context) {
|
||||
$('input[name="test_assert_wait_on_ajax_input"]').val('js_webassert_test');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @file
|
||||
* Testing behavior for JSWebAssertTest.
|
||||
*/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
/**
|
||||
* @type {Drupal~behavior}
|
||||
*
|
||||
* @prop {Drupal~behaviorAttach} attach
|
||||
* Makes changes in the DOM to be able to test the completion of AJAX in assertWaitOnAjaxRequest.
|
||||
*/
|
||||
Drupal.behaviors.js_webassert_test_wait_for_element = {
|
||||
attach(context) {
|
||||
$('#js_webassert_test_element_invisible').show();
|
||||
},
|
||||
};
|
||||
}(jQuery, Drupal, drupalSettings));
|
||||
+7
-15
@@ -1,22 +1,14 @@
|
||||
/**
|
||||
* @file
|
||||
* Testing behavior for JSWebAssertTest.
|
||||
*/
|
||||
* DO NOT EDIT THIS FILE.
|
||||
* See the following change record for more information,
|
||||
* https://www.drupal.org/node/2815083
|
||||
* @preserve
|
||||
**/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @type {Drupal~behavior}
|
||||
*
|
||||
* @prop {Drupal~behaviorAttach} attach
|
||||
* Makes changes in the DOM to be able to test the completion of AJAX in assertWaitOnAjaxRequest.
|
||||
*/
|
||||
Drupal.behaviors.js_webassert_test_wait_for_element = {
|
||||
attach: function (context) {
|
||||
attach: function attach(context) {
|
||||
$('#js_webassert_test_element_invisible').show();
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -8,8 +8,8 @@ hidden: true
|
||||
dependencies:
|
||||
- entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -14,5 +14,6 @@ function keyvalue_test_entity_type_alter(array &$entity_types) {
|
||||
$entity_types['entity_test_label']->setStorageClass('Drupal\Core\Entity\KeyValueStore\KeyValueContentEntityStorage');
|
||||
$entity_keys = $entity_types['entity_test_label']->getKeys();
|
||||
$entity_types['entity_test_label']->set('entity_keys', $entity_keys + ['uuid' => 'uuid']);
|
||||
$entity_types['entity_test_label']->set('provider', 'keyvalue_test');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
/* stylelint-disable plugin/no-browser-hacks */
|
||||
.layout-example-2col .region-left {
|
||||
float: left;
|
||||
width: 50%;
|
||||
@@ -14,3 +14,4 @@
|
||||
* html .layout-example-2col .region-right {
|
||||
width: 49.9%;
|
||||
}
|
||||
/* stylelint-disable */
|
||||
|
||||
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides hook implementations for Layout Test.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK() for layout templates.
|
||||
*/
|
||||
function template_preprocess_layout_test_2col(&$variables) {
|
||||
$variables['region_attributes']['left']->addClass('class-added-by-preprocess');
|
||||
}
|
||||
@@ -4,11 +4,11 @@
|
||||
* Template for an example 1 column layout.
|
||||
*/
|
||||
#}
|
||||
<div class="layout-example-1col clearfix">
|
||||
<div class="region-top">
|
||||
<div{{ attributes.addClass('layout-example-1col', 'clearfix') }}>
|
||||
<div {{ region_attributes.top.addClass('region-top') }}>
|
||||
{{ content.top }}
|
||||
</div>
|
||||
<div class="region-bottom">
|
||||
<div {{ region_attributes.bottom.addClass('region-bottom') }}>
|
||||
{{ content.bottom }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user