upgrades core to 8.4.2

This commit is contained in:
Bachir Soussi Chiadmi
2017-11-14 16:09:54 +01:00
parent bd60eff9b3
commit c2b4e25be4
3504 changed files with 140306 additions and 38684 deletions
@@ -5,8 +5,11 @@ system.site:
label: 'Site information'
mapping:
uuid:
type: string
type: uuid
label: 'Site UUID'
constraints:
Uuid: []
NotNull: []
name:
type: label
label: 'Site name'
@@ -185,13 +188,6 @@ system.performance:
gzip:
type: boolean
label: 'Compress JavaScript files.'
response:
type: mapping
label: 'Response performance settings'
mapping:
gzip:
type: boolean
label: 'Compress cached pages'
stale_file_threshold:
type: integer
label: 'Stale file threshold'
+7 -2
View File
@@ -211,7 +211,7 @@ small .admin-link:after {
background-color: transparent;
}
[dir="rtl"] .system-status-report__status-title {
padding: 10px 40px 10px 6px;
padding: 10px 40px 10px 6px;
}
.system-status-report__status-icon:before {
content: "";
@@ -223,7 +223,7 @@ small .admin-link:after {
left: 12px; /* LTR */
top: 12px;
}
[dir="rtl"] .system-status-report__status-icon:before {
[dir="rtl"] .system-status-report__status-icon:before {
left: auto;
right: 12px;
}
@@ -394,3 +394,8 @@ small .admin-link:after {
.cron-description__run-cron {
display: block;
}
.system-cron-settings__link {
overflow-wrap: break-word;
word-wrap: break-word;
}
+51
View File
@@ -0,0 +1,51 @@
/**
* @file
* Provides date format preview feature.
*/
(function ($, Drupal, drupalSettings) {
const dateFormats = drupalSettings.dateFormats;
/**
* Display the preview for date format entered.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attach behavior for previewing date formats on input elements.
*/
Drupal.behaviors.dateFormat = {
attach(context) {
const $context = $(context);
const $source = $context.find('[data-drupal-date-formatter="source"]').once('dateFormat');
const $target = $context.find('[data-drupal-date-formatter="preview"]').once('dateFormat');
const $preview = $target.find('em');
// All elements have to exist.
if (!$source.length || !$target.length) {
return;
}
/**
* Event handler that replaces date characters with value.
*
* @param {jQuery.Event} e
* The jQuery event triggered.
*/
function dateFormatHandler(e) {
const baseValue = $(e.target).val() || '';
const dateString = baseValue.replace(/\\?(.?)/gi, (key, value) => dateFormats[key] ? dateFormats[key] : value);
$preview.html(dateString);
$target.toggleClass('js-hide', !dateString.length);
}
/**
* On given event triggers the date character replacement.
*/
$source.on('keyup.dateFormat change.dateFormat input.dateFormat', dateFormatHandler)
// Initialize preview.
.trigger('keyup');
},
};
}(jQuery, Drupal, drupalSettings));
+8 -30
View File
@@ -1,40 +1,24 @@
/**
* @file
* Provides date format preview feature.
*/
* 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';
var dateFormats = drupalSettings.dateFormats;
/**
* Display the preview for date format entered.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attach behavior for previewing date formats on input elements.
*/
Drupal.behaviors.dateFormat = {
attach: function (context) {
attach: function attach(context) {
var $context = $(context);
var $source = $context.find('[data-drupal-date-formatter="source"]').once('dateFormat');
var $target = $context.find('[data-drupal-date-formatter="preview"]').once('dateFormat');
var $preview = $target.find('em');
// All elements have to exist.
if (!$source.length || !$target.length) {
return;
}
/**
* Event handler that replaces date characters with value.
*
* @param {jQuery.Event} e
* The jQuery event triggered.
*/
function dateFormatHandler(e) {
var baseValue = $(e.target).val() || '';
var dateString = baseValue.replace(/\\?(.?)/gi, function (key, value) {
@@ -45,13 +29,7 @@
$target.toggleClass('js-hide', !dateString.length);
}
/**
* On given event triggers the date character replacement.
*/
$source.on('keyup.dateFormat change.dateFormat input.dateFormat', dateFormatHandler)
// Initialize preview.
.trigger('keyup');
$source.on('keyup.dateFormat change.dateFormat input.dateFormat', dateFormatHandler).trigger('keyup');
}
};
})(jQuery, Drupal, drupalSettings);
})(jQuery, Drupal, drupalSettings);
+77
View File
@@ -0,0 +1,77 @@
/**
* @file
* System behaviors.
*/
(function ($, Drupal, drupalSettings) {
// Cache IDs in an array for ease of use.
const ids = [];
/**
* Attaches field copy behavior from input fields to other input fields.
*
* When a field is filled out, apply its value to other fields that will
* likely use the same value. In the installer this is used to populate the
* administrator email address with the same value as the site email address.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the field copy behavior to an input field.
*/
Drupal.behaviors.copyFieldValue = {
attach(context) {
// List of fields IDs on which to bind the event listener.
// Create an array of IDs to use with jQuery.
for (const sourceId in drupalSettings.copyFieldValue) {
if (drupalSettings.copyFieldValue.hasOwnProperty(sourceId)) {
ids.push(sourceId);
}
}
if (ids.length) {
// Listen to value:copy events on all dependent fields.
// We have to use body and not document because of the way jQuery events
// bubble up the DOM tree.
$('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler);
// Listen on all source elements.
$(`#${ids.join(', #')}`).once('copy-field-values').on('blur', this.valueSourceBlurHandler);
}
},
detach(context, settings, trigger) {
if (trigger === 'unload' && ids.length) {
$('body').removeOnce('copy-field-values').off('value:copy');
$(`#${ids.join(', #')}`).removeOnce('copy-field-values').off('blur');
}
},
/**
* Event handler that fill the target element with the specified value.
*
* @param {jQuery.Event} e
* Event object.
* @param {string} value
* Custom value from jQuery trigger.
*/
valueTargetCopyHandler(e, value) {
const $target = $(e.target);
if ($target.val() === '') {
$target.val(value);
}
},
/**
* Handler for a Blur event on a source field.
*
* This event handler will trigger a 'value:copy' event on all dependent
* fields.
*
* @param {jQuery.Event} e
* The event triggered.
*/
valueSourceBlurHandler(e) {
const value = $(e.target).val();
const targetIds = drupalSettings.copyFieldValue[e.target.id];
$(`#${targetIds.join(', #')}`).trigger('value:copy', value);
},
};
}(jQuery, Drupal, drupalSettings));
+11 -50
View File
@@ -1,81 +1,42 @@
/**
* @file
* System behaviors.
*/
* 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';
// Cache IDs in an array for ease of use.
var ids = [];
/**
* Attaches field copy behavior from input fields to other input fields.
*
* When a field is filled out, apply its value to other fields that will
* likely use the same value. In the installer this is used to populate the
* administrator email address with the same value as the site email address.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the field copy behavior to an input field.
*/
Drupal.behaviors.copyFieldValue = {
attach: function (context) {
// List of fields IDs on which to bind the event listener.
// Create an array of IDs to use with jQuery.
attach: function attach(context) {
for (var sourceId in drupalSettings.copyFieldValue) {
if (drupalSettings.copyFieldValue.hasOwnProperty(sourceId)) {
ids.push(sourceId);
}
}
if (ids.length) {
// Listen to value:copy events on all dependent fields.
// We have to use body and not document because of the way jQuery events
// bubble up the DOM tree.
$('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler);
// Listen on all source elements.
$('#' + ids.join(', #')).once('copy-field-values').on('blur', this.valueSourceBlurHandler);
}
},
detach: function (context, settings, trigger) {
detach: function detach(context, settings, trigger) {
if (trigger === 'unload' && ids.length) {
$('body').removeOnce('copy-field-values').off('value:copy');
$('#' + ids.join(', #')).removeOnce('copy-field-values').off('blur');
}
},
/**
* Event handler that fill the target element with the specified value.
*
* @param {jQuery.Event} e
* Event object.
* @param {string} value
* Custom value from jQuery trigger.
*/
valueTargetCopyHandler: function (e, value) {
valueTargetCopyHandler: function valueTargetCopyHandler(e, value) {
var $target = $(e.target);
if ($target.val() === '') {
$target.val(value);
}
},
/**
* Handler for a Blur event on a source field.
*
* This event handler will trigger a 'value:copy' event on all dependent
* fields.
*
* @param {jQuery.Event} e
* The event triggered.
*/
valueSourceBlurHandler: function (e) {
valueSourceBlurHandler: function valueSourceBlurHandler(e) {
var value = $(e.target).val();
var targetIds = drupalSettings.copyFieldValue[e.target.id];
$('#' + targetIds.join(', #')).trigger('value:copy', value);
}
};
})(jQuery, Drupal, drupalSettings);
})(jQuery, Drupal, drupalSettings);
@@ -0,0 +1,99 @@
/**
* @file
* Module page behaviors.
*/
(function ($, Drupal, debounce) {
/**
* Filters the module list table by a text input search string.
*
* Additionally accounts for multiple tables being wrapped in "package" details
* elements.
*
* Text search input: input.table-filter-text
* Target table: input.table-filter-text[data-table]
* Source text: .table-filter-text-source, .module-name, .module-description
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.tableFilterByText = {
attach(context, settings) {
const $input = $('input.table-filter-text').once('table-filter-text');
const $table = $($input.attr('data-table'));
let $rowsAndDetails;
let $rows;
let $details;
let searching = false;
function hidePackageDetails(index, element) {
const $packDetails = $(element);
const $visibleRows = $packDetails.find('tbody tr:visible');
$packDetails.toggle($visibleRows.length > 0);
}
function filterModuleList(e) {
const query = $(e.target).val();
// Case insensitive expression to find query at the beginning of a word.
const re = new RegExp(`\\b${query}`, 'i');
function showModuleRow(index, row) {
const $row = $(row);
const $sources = $row.find('.table-filter-text-source, .module-name, .module-description');
const textMatch = $sources.text().search(re) !== -1;
$row.closest('tr').toggle(textMatch);
}
// Search over all rows and packages.
$rowsAndDetails.show();
// Filter if the length of the query is at least 2 characters.
if (query.length >= 2) {
searching = true;
$rows.each(showModuleRow);
// Note that we first open all <details> to be able to use ':visible'.
// Mark the <details> elements that were closed before filtering, so
// they can be reclosed when filtering is removed.
$details.not('[open]').attr('data-drupal-system-state', 'forced-open');
// Hide the package <details> if they don't have any visible rows.
// Note that we first show() all <details> to be able to use ':visible'.
$details.attr('open', true).each(hidePackageDetails);
Drupal.announce(
Drupal.t(
'!modules modules are available in the modified list.',
{ '!modules': $rowsAndDetails.find('tbody tr:visible').length },
),
);
}
else if (searching) {
searching = false;
$rowsAndDetails.show();
// Return <details> elements that had been closed before filtering
// to a closed state.
$details.filter('[data-drupal-system-state="forced-open"]')
.removeAttr('data-drupal-system-state')
.attr('open', false);
}
}
function preventEnterKey(event) {
if (event.which === 13) {
event.preventDefault();
event.stopPropagation();
}
}
if ($table.length) {
$rowsAndDetails = $table.find('tr, details');
$rows = $table.find('tbody tr');
$details = $rowsAndDetails.filter('.package-listing');
$input.on({
keyup: debounce(filterModuleList, 200),
keydown: preventEnterKey,
});
}
},
};
}(jQuery, Drupal, Drupal.debounce));
+16 -45
View File
@@ -1,31 +1,18 @@
/**
* @file
* Module page behaviors.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, debounce) {
'use strict';
/**
* Filters the module list table by a text input search string.
*
* Additionally accounts for multiple tables being wrapped in "package" details
* elements.
*
* Text search input: input.table-filter-text
* Target table: input.table-filter-text[data-table]
* Source text: .table-filter-text-source, .module-name, .module-description
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.tableFilterByText = {
attach: function (context, settings) {
attach: function attach(context, settings) {
var $input = $('input.table-filter-text').once('table-filter-text');
var $table = $($input.attr('data-table'));
var $rowsAndDetails;
var $rows;
var $details;
var $rowsAndDetails = void 0;
var $rows = void 0;
var $details = void 0;
var searching = false;
function hidePackageDetails(index, element) {
@@ -36,7 +23,7 @@
function filterModuleList(e) {
var query = $(e.target).val();
// Case insensitive expression to find query at the beginning of a word.
var re = new RegExp('\\b' + query, 'i');
function showModuleRow(index, row) {
@@ -45,38 +32,23 @@
var textMatch = $sources.text().search(re) !== -1;
$row.closest('tr').toggle(textMatch);
}
// Search over all rows and packages.
$rowsAndDetails.show();
// Filter if the length of the query is at least 2 characters.
if (query.length >= 2) {
searching = true;
$rows.each(showModuleRow);
// Note that we first open all <details> to be able to use ':visible'.
// Mark the <details> elements that were closed before filtering, so
// they can be reclosed when filtering is removed.
$details.not('[open]').attr('data-drupal-system-state', 'forced-open');
// Hide the package <details> if they don't have any visible rows.
// Note that we first show() all <details> to be able to use ':visible'.
$details.attr('open', true).each(hidePackageDetails);
Drupal.announce(
Drupal.t(
'!modules modules are available in the modified list.',
{'!modules': $rowsAndDetails.find('tbody tr:visible').length}
)
);
}
else if (searching) {
Drupal.announce(Drupal.t('!modules modules are available in the modified list.', { '!modules': $rowsAndDetails.find('tbody tr:visible').length }));
} else if (searching) {
searching = false;
$rowsAndDetails.show();
// Return <details> elements that had been closed before filtering
// to a closed state.
$details.filter('[data-drupal-system-state="forced-open"]')
.removeAttr('data-drupal-system-state')
.attr('open', false);
$details.filter('[data-drupal-system-state="forced-open"]').removeAttr('data-drupal-system-state').attr('open', false);
}
}
@@ -99,5 +71,4 @@
}
}
};
}(jQuery, Drupal, Drupal.debounce));
})(jQuery, Drupal, Drupal.debounce);
@@ -8,6 +8,7 @@ source:
- date_format_long
- date_format_medium
- date_format_short
source_module: system
process:
id:
plugin: static_map
@@ -8,6 +8,7 @@ source:
- cron_threshold_warning
- cron_threshold_error
- cron_last
source_module: system
process:
'threshold/requirements_warning': cron_threshold_warning
'threshold/requirements_error': cron_threshold_error
@@ -8,6 +8,7 @@ source:
- configurable_timezones
- date_first_day
- date_default_timezone
source_module: system
process:
'timezone/user/configurable': configurable_timezones
first_day: date_first_day
@@ -7,6 +7,7 @@ source:
variables:
- file_directory_temp
- allow_insecure_uploads
source_module: system
process:
'path/temporary': file_directory_temp
allow_insecure_uploads:
@@ -10,11 +10,11 @@ source:
- cache_lifetime
- cache
- page_compression
source_module: system
process:
'css/preprocess': preprocess_css
'js/preprocess': preprocess_js
'cache/page/max_age': cache_lifetime
'response/gzip': page_compression
destination:
plugin: config
config_name: system.performance
@@ -6,6 +6,7 @@ source:
plugin: variable
variables:
- theme_settings
source_module: system
process:
'features/logo': theme_settings/toggle_logo
'features/name': theme_settings/toggle_name
@@ -1,10 +1,12 @@
id: d7_system_authorize
label: Drupal 7 file transfer authorize configuration
migration_tags:
- Drupal 7
source:
plugin: variable
variables:
- authorize_filetransfer_default
source_module: system
process:
filetransfer_default: authorize_filetransfer_default
destination:
@@ -7,6 +7,7 @@ source:
variables:
- cron_threshold_warning
- cron_threshold_error
source_module: system
process:
'threshold/requirements_warning': cron_threshold_warning
'threshold/requirements_error': cron_threshold_error
@@ -1,4 +1,5 @@
id: d7_system_date
label: Drupal 7 system date configuration
migration_tags:
- Drupal 7
source:
@@ -10,6 +11,7 @@ source:
- configurable_timezones
- empty_timezone_message
- user_default_timezone
source_module: system
process:
'country/default': site_default_country
first_day: date_first_day
@@ -7,6 +7,7 @@ source:
variables:
- allow_insecure_uploads
- file_temporary_path
source_module: system
process:
allow_insecure_uploads:
plugin: static_map
@@ -1,10 +1,12 @@
id: d7_system_mail
label: Drupal 7 system mail configuration
migration_tags:
- Drupal 7
source:
plugin: variable
variables:
- mail_system
source_module: system
process:
'interface/default':
plugin: static_map
@@ -9,11 +9,11 @@ source:
- preprocess_js
- cache_lifetime
- page_compression
source_module: system
process:
'css/preprocess': preprocess_css
'js/preprocess': preprocess_js
'cache/page/max_age': cache_lifetime
'response/gzip': page_compression
destination:
plugin: config
config_name: system.performance
@@ -7,6 +7,7 @@ source:
plugin: variable
variables:
- image_toolkit
source_module: system
process:
toolkit: image_toolkit
destination:
@@ -7,6 +7,7 @@ source:
plugin: variable
variables:
- image_jpeg_quality
source_module: system
process:
jpeg_quality: image_jpeg_quality
destination:
@@ -7,6 +7,7 @@ source:
plugin: variable
variables:
- error_level
source_module: system
process:
error_level:
plugin: static_map
@@ -7,6 +7,7 @@ source:
plugin: variable
variables:
- site_offline_message
source_module: system
process:
message: site_offline_message
destination:
@@ -8,6 +8,7 @@ source:
variables:
- feed_default_items
- feed_item_length
source_module: system
process:
'items/limit': feed_default_items
'items/view_mode': feed_item_length
@@ -16,6 +16,7 @@ source:
- site_404
- drupal_weight_select_max
- admin_compact_mode
source_module: system
process:
name: site_name
mail: site_mail
@@ -61,11 +61,22 @@ class BatchController implements ContainerInjectionInterface {
return $output;
}
elseif (isset($output)) {
$title = isset($output['#title']) ? $output['#title'] : NULL;
$page = [
'#type' => 'page',
'#title' => $title,
'#show_messages' => FALSE,
'content' => $output,
];
// Also inject title as a page header (if available).
if ($title) {
$page['header'] = [
'#type' => 'page_title',
'#title' => $title,
];
}
return $page;
}
}
@@ -9,6 +9,18 @@ use Drupal\Core\Controller\ControllerBase;
*/
class Http4xxController extends ControllerBase {
/**
* The default 4xx error content.
*
* @return array
* A render array containing the message to display for 4xx errors.
*/
public function on4xx() {
return [
'#markup' => $this->t('A client error happened'),
];
}
/**
* The default 401 content.
*
@@ -14,18 +14,23 @@ use Drupal\Core\Session\AccountInterface;
*/
class DateFormatAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected $viewLabelOperation = TRUE;
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// There are no restrictions on viewing a date format.
if ($operation == 'view') {
// There are no restrictions on viewing the label of a date format.
if ($operation === 'view label') {
return AccessResult::allowed();
}
// Locked date formats cannot be updated or deleted.
elseif (in_array($operation, ['update', 'delete'])) {
if ($entity->isLocked()) {
return AccessResult::forbidden()->addCacheableDependency($entity);
return AccessResult::forbidden('The DateFormat config entity is locked.')->addCacheableDependency($entity);
}
else {
return parent::checkAccess($entity, $operation, $account)->addCacheableDependency($entity);
+13 -8
View File
@@ -16,6 +16,7 @@ use Drupal\Core\Form\ConfigFormBaseTrait;
* Configure cron settings for this site.
*/
class CronForm extends FormBase {
use ConfigFormBaseTrait;
/**
@@ -42,7 +43,7 @@ class CronForm extends FormBase {
/**
* The module handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
@@ -104,6 +105,7 @@ class CronForm extends FormBase {
$form['run'] = [
'#type' => 'submit',
'#value' => t('Run cron'),
'#submit' => ['::runCron'],
];
$status = '<p>' . $this->t('Last run: %time ago.', ['%time' => $this->dateFormatter->formatTimeDiffSince($this->state->get('system.cron_last'))]) . '</p>';
$form['status'] = [
@@ -112,7 +114,7 @@ class CronForm extends FormBase {
$cron_url = $this->url('system.cron', ['key' => $this->state->get('system.cron_key')], ['absolute' => TRUE]);
$form['cron_url'] = [
'#markup' => '<p>' . t('To run cron from outside the site, go to <a href=":cron">@cron</a>', [':cron' => $cron_url, '@cron' => $cron_url]) . '</p>',
'#markup' => '<p>' . t('To run cron from outside the site, go to <a href=":cron" class="system-cron-settings__link">@cron</a>', [':cron' => $cron_url, '@cron' => $cron_url]) . '</p>',
];
if (!$this->moduleHandler->moduleExists('automated_cron')) {
@@ -131,7 +133,7 @@ class CronForm extends FormBase {
'#type' => 'checkbox',
'#title' => t('Detailed cron logging'),
'#default_value' => $this->config('system.cron')->get('logging'),
'#description' => 'Run times of individual cron jobs will be written to watchdog',
'#description' => $this->t('Run times of individual cron jobs will be written to watchdog'),
];
$form['actions']['#type'] = 'actions';
@@ -145,22 +147,25 @@ class CronForm extends FormBase {
}
/**
* Runs cron and reloads the page.
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('system.cron')
->set('logging', $form_state->getValue('logging'))
->save();
drupal_set_message(t('The configuration options have been saved.'));
}
// Run cron manually from Cron form.
/**
* Form submission handler for running cron manually.
*/
public function runCron(array &$form, FormStateInterface $form_state) {
if ($this->cron->run()) {
drupal_set_message(t('Cron ran successfully.'));
drupal_set_message($this->t('Cron ran successfully.'));
}
else {
drupal_set_message(t('Cron run failed.'), 'error');
drupal_set_message($this->t('Cron run failed.'), 'error');
}
}
}
@@ -43,8 +43,8 @@ class DateFormatDeleteForm extends EntityDeleteForm {
public function getQuestion() {
return t('Are you sure you want to delete the format %name : %format?', [
'%name' => $this->entity->label(),
'%format' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id())]
);
'%format' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id()),
]);
}
}
@@ -125,10 +125,10 @@ class FileSystemForm extends ConfigFormBase {
$period[0] = t('Never');
$form['temporary_maximum_age'] = [
'#type' => 'select',
'#title' => t('Delete orphaned files after'),
'#title' => t('Delete temporary files after'),
'#default_value' => $config->get('temporary_maximum_age'),
'#options' => $period,
'#description' => t('Orphaned files are not referenced from any content but remain in the file system and may appear in administrative listings. <strong>Warning:</strong> If enabled, orphaned files will be permanently deleted and may not be recoverable.'),
'#description' => t('Temporary files are not referenced, but are in the file system and therefore may show up in administrative lists. <strong>Warning:</strong> If enabled, temporary files will be permanently deleted and may not be recoverable.'),
];
return parent::buildForm($form, $form_state);
@@ -5,7 +5,6 @@ namespace Drupal\system\Form;
use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -15,13 +14,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class PerformanceForm extends ConfigFormBase {
/**
* The render cache bin.
*
* @var \Drupal\Core\Cache\CacheBackendInterface
*/
protected $renderCache;
/**
* The date formatter service.
*
@@ -48,7 +40,6 @@ class PerformanceForm extends ConfigFormBase {
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Cache\CacheBackendInterface $render_cache
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
* @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $css_collection_optimizer
@@ -56,10 +47,9 @@ class PerformanceForm extends ConfigFormBase {
* @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $js_collection_optimizer
* The JavaScript asset collection optimizer service.
*/
public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $render_cache, DateFormatterInterface $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
parent::__construct($config_factory);
$this->renderCache = $render_cache;
$this->dateFormatter = $date_formatter;
$this->cssCollectionOptimizer = $css_collection_optimizer;
$this->jsCollectionOptimizer = $js_collection_optimizer;
@@ -71,7 +61,6 @@ class PerformanceForm extends ConfigFormBase {
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory'),
$container->get('cache.render'),
$container->get('date.formatter'),
$container->get('asset.css.collection_optimizer'),
$container->get('asset.js.collection_optimizer')
@@ -168,10 +157,6 @@ class PerformanceForm extends ConfigFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->cssCollectionOptimizer->deleteAll();
$this->jsCollectionOptimizer->deleteAll();
// This form allows page compression settings to be changed, which can
// invalidate cached pages in the render cache, so it needs to be cleared on
// form submit.
$this->renderCache->deleteAll();
$this->config('system.performance')
->set('cache.page.max_age', $form_state->getValue('page_cache_maximum_age'))
@@ -65,7 +65,7 @@ class RegionalForm extends ConfigFormBase {
$system_date = $this->config('system.date');
// Date settings:
$zones = system_time_zones();
$zones = system_time_zones(NULL, TRUE);
$form['locale'] = [
'#type' => 'details',
@@ -324,9 +324,21 @@ class ThemeSettingsForm extends ConfigFormBase {
// Process the theme and all its base themes.
foreach ($theme_keys as $theme) {
// Include the theme-settings.php file.
$filename = DRUPAL_ROOT . '/' . $themes[$theme]->getPath() . '/theme-settings.php';
if (file_exists($filename)) {
require_once $filename;
$theme_path = drupal_get_path('theme', $theme);
$theme_settings_file = $theme_path . '/theme-settings.php';
$theme_file = $theme_path . '/' . $theme . '.theme';
$filenames = [$theme_settings_file, $theme_file];
foreach ($filenames as $filename) {
if (file_exists($filename)) {
require_once $filename;
// The file must be required for the cached form too.
$files = $form_state->getBuildInfo()['files'];
if (!in_array($filename, $files)) {
$files[] = $filename;
}
$form_state->addBuildInfo('files', $files);
}
}
// Call theme-specific settings.
@@ -14,17 +14,23 @@ use Drupal\Core\Session\AccountInterface;
*/
class MenuAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected $viewLabelOperation = TRUE;
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation === 'view') {
// There are no restrictions on viewing the label of a date format.
if ($operation === 'view label') {
return AccessResult::allowed();
}
// Locked menus could not be deleted.
elseif ($operation == 'delete') {
elseif ($operation === 'delete') {
if ($entity->isLocked()) {
return AccessResult::forbidden()->addCacheableDependency($entity);
return AccessResult::forbidden('The Menu config entity is locked.')->addCacheableDependency($entity);
}
else {
return parent::checkAccess($entity, $operation, $account)->addCacheableDependency($entity);
@@ -11,6 +11,7 @@ use Drupal\Core\Controller\TitleResolverInterface;
use Drupal\Core\Link;
use Drupal\Core\ParamConverter\ParamNotConvertedException;
use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\Path\PathMatcherInterface;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\Routing\RequestContext;
use Drupal\Core\Routing\RouteMatch;
@@ -79,6 +80,20 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
*/
protected $currentUser;
/**
* The current path service.
*
* @var \Drupal\Core\Path\CurrentPathStack
*/
protected $currentPath;
/**
* The patch matcher service.
*
* @var \Drupal\Core\Path\PathMatcherInterface
*/
protected $pathMatcher;
/**
* Constructs the PathBasedBreadcrumbBuilder.
*
@@ -98,8 +113,10 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
* The current user object.
* @param \Drupal\Core\Path\CurrentPathStack $current_path
* The current path.
* @param \Drupal\Core\Path\PathMatcherInterface $path_matcher
* The path matcher service.
*/
public function __construct(RequestContext $context, AccessManagerInterface $access_manager, RequestMatcherInterface $router, InboundPathProcessorInterface $path_processor, ConfigFactoryInterface $config_factory, TitleResolverInterface $title_resolver, AccountInterface $current_user, CurrentPathStack $current_path) {
public function __construct(RequestContext $context, AccessManagerInterface $access_manager, RequestMatcherInterface $router, InboundPathProcessorInterface $path_processor, ConfigFactoryInterface $config_factory, TitleResolverInterface $title_resolver, AccountInterface $current_user, CurrentPathStack $current_path, PathMatcherInterface $path_matcher = NULL) {
$this->context = $context;
$this->accessManager = $access_manager;
$this->router = $router;
@@ -108,6 +125,7 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
$this->titleResolver = $title_resolver;
$this->currentUser = $current_user;
$this->currentPath = $current_path;
$this->pathMatcher = $path_matcher ?: \Drupal::service('path.matcher');
}
/**
@@ -124,6 +142,15 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
$breadcrumb = new Breadcrumb();
$links = [];
// Add the url.path.parent cache context. This code ignores the last path
// part so the result only depends on the path parents.
$breadcrumb->addCacheContexts(['url.path.parent']);
// Do not display a breadcrumb on the frontpage.
if ($this->pathMatcher->isFrontPage()) {
return $breadcrumb;
}
// General path-based breadcrumbs. Use the actual request path, prior to
// resolving path aliases, so the breadcrumb can be defined by simply
// creating a hierarchy of path aliases.
@@ -136,9 +163,6 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
// /user is just a redirect, so skip it.
// @todo Find a better way to deal with /user.
$exclude['/user'] = TRUE;
// Add the url.path.parent cache context. This code ignores the last path
// part so the result only depends on the path parents.
$breadcrumb->addCacheContexts(['url.path.parent']);
while (count($path_elements) > 1) {
array_pop($path_elements);
// Copy the path elements for up-casting.
@@ -160,12 +184,10 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
$links[] = new Link($title, $url);
}
}
}
}
if ($path && '/' . $path != $front) {
// Add the Home link, except for the front page.
$links[] = Link::createFromRoute($this->t('Home'), '<front>');
}
// Add the Home link.
$links[] = Link::createFromRoute($this->t('Home'), '<front>');
return $breadcrumb->setLinks(array_reverse($links));
}
@@ -147,6 +147,25 @@ class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterfa
$parameters->setMaxDepth(min($level + $depth - 1, $this->menuTree->maxDepth()));
}
// For menu blocks with start level greater than 1, only show menu items
// from the current active trail. Adjust the root according to the current
// position in the menu in order to determine if we can show the subtree.
if ($level > 1) {
if (count($parameters->activeTrail) >= $level) {
// Active trail array is child-first. Reverse it, and pull the new menu
// root based on the parent of the configured start level.
$menu_trail_ids = array_reverse(array_values($parameters->activeTrail));
$menu_root = $menu_trail_ids[$level - 1];
$parameters->setRoot($menu_root)->setMinDepth(1);
if ($depth > 0) {
$parameters->setMaxDepth(min($level - 1 + $depth - 1, $this->menuTree->maxDepth()));
}
}
else {
return [];
}
}
$tree = $this->menuTree->load($menu_name, $parameters);
$manipulators = [
['callable' => 'menu.default_tree_manipulators:checkAccess'],
@@ -45,7 +45,7 @@ class Rotate extends GDImageToolkitOperationBase {
// Validate or set background color argument.
if (!empty($arguments['background'])) {
// Validate the background color: Color::hexToRgb does so for us.
$background = Color::hexToRgb($arguments['background']) + [ 'alpha' => 0 ];
$background = Color::hexToRgb($arguments['background']) + ['alpha' => 0];
}
else {
// Background color is not specified: use transparent white as background.
@@ -9,7 +9,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
*
* @MigrateSource(
* id = "menu",
* source_provider = "menu"
* source_module = "menu"
* )
*/
class Menu extends DrupalSqlBase {
@@ -9,7 +9,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow;
*
* @MigrateSource(
* id = "d7_theme_settings",
* source_provider = "system"
* source_module = "system"
* )
*/
class ThemeSettings extends VariableMultiRow {
@@ -25,7 +25,7 @@ class SystemConfigSubscriber implements EventSubscriberInterface {
/**
* Constructs the SystemConfigSubscriber.
*
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* @param \Drupal\Core\Routing\RouteBuilderInterface $router_builder
* The router builder service.
*/
public function __construct(RouteBuilderInterface $router_builder) {
+1 -1
View File
@@ -110,7 +110,7 @@ class SystemManager {
// Check run-time requirements and status information.
$requirements = $this->moduleHandler->invokeAll('requirements', ['runtime']);
uasort($requirements, function($a, $b) {
uasort($requirements, function ($a, $b) {
if (!isset($a['weight'])) {
if (!isset($b['weight'])) {
return strcasecmp($a['title'], $b['title']);
@@ -124,7 +124,7 @@ class CommandsTest extends AjaxTestBase {
* Regression test: Settings command exists regardless of JS aggregation.
*/
public function testAttachedSettings() {
$assert = function($message) {
$assert = function ($message) {
$response = new AjaxResponse();
$response->setAttachments([
'library' => ['core/drupalSettings'],
@@ -175,10 +175,12 @@ class DialogTest extends AjaxTestBase {
'edit-preview' => [
'callback' => '::preview',
'event' => 'click',
'url' => Url::fromRoute('ajax_test.dialog_form', [], ['query' => [
'url' => Url::fromRoute('ajax_test.dialog_form', [], [
'query' => [
MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_modal',
FormBuilderInterface::AJAX_FORM_REQUEST => TRUE,
]])->toString(),
],
])->toString(),
'dialogType' => 'ajax',
'submit' => [
'_triggering_element_name' => 'op',
@@ -44,7 +44,7 @@ class MultiFormTest extends AjaxTestBase {
->save();
// Log in a user who can create 'page' nodes.
$this->drupalLogin ($this->drupalCreateUser(['create page content']));
$this->drupalLogin($this->drupalCreateUser(['create page content']));
}
/**
@@ -15,7 +15,7 @@ class ErrorContainer extends Container {
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
if ($id === 'http_kernel') {
// Enforce a recoverable error.
$callable = function(ErrorContainer $container) {
$callable = function (ErrorContainer $container) {
};
$callable(1);
}
@@ -9,6 +9,12 @@ use Drupal\Core\Url;
* Provides test assertions for testing page-level cache contexts & tags.
*
* Can be used by test classes that extend \Drupal\simpletest\WebTestBase.
*
* @deprecated Scheduled for removal in Drupal 9.0.0. Use
* \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait
* instead.
*
* @see https://www.drupal.org/node/2896632
*/
trait AssertPageCacheContextsAndTagsTrait {
@@ -91,7 +97,7 @@ trait AssertPageCacheContextsAndTagsTrait {
// Assert page cache item + expected cache tags.
$cid_parts = [$url->setAbsolute()->toString(), 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$this->assertEqual($cache_entry->tags, $expected_tags);
$this->debugCacheTags($cache_entry->tags, $expected_tags);
@@ -69,7 +69,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
* @return \Drupal\Core\Cache\CacheBackendInterface
* Cache backend to test.
*/
protected abstract function createCacheBackend($bin);
abstract protected function createCacheBackend($bin);
/**
* Allows specific implementation to change the environment before a test run.
@@ -303,9 +303,11 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
$reference = [
'test3',
'test7',
'test21', // Cid does not exist.
// Cid does not exist.
'test21',
'test6',
'test19', // Cid does not exist until added before second getMultiple().
// Cid does not exist until added before second getMultiple().
'test19',
'test2',
];
@@ -443,13 +445,16 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
$backend->set('test7', 17);
$backend->delete('test1');
$backend->delete('test23'); // Nonexistent key should not cause an error.
// Nonexistent key should not cause an error.
$backend->delete('test23');
$backend->deleteMultiple([
'test3',
'test5',
'test7',
'test19', // Nonexistent key should not cause an error.
'test21', // Nonexistent key should not cause an error.
// Nonexistent key should not cause an error.
'test19',
// Nonexistent key should not cause an error.
'test21',
]);
// Test if expected keys have been deleted.
@@ -54,7 +54,7 @@ abstract class PageCacheTagsTestBase extends WebTestBase {
$absolute_url = $url->setAbsolute()->toString();
$cid_parts = [$absolute_url, 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$tags = array_unique($tags);
sort($tags);
@@ -168,7 +168,7 @@ class UrlTest extends WebTestBase {
$l = \Drupal::l('foo', Url::fromUri('https://www.drupal.org'));
// Test a renderable array passed to the link generator.
$renderer->executeInRenderContext(new RenderContext(), function() use ($renderer, $l) {
$renderer->executeInRenderContext(new RenderContext(), function () use ($renderer, $l) {
$renderable_text = ['#markup' => 'foo'];
$l_renderable_text = \Drupal::l($renderable_text, Url::fromUri('https://www.drupal.org'));
$this->assertEqual($l_renderable_text, $l);
@@ -14,4 +14,4 @@ namespace Drupal\system\Tests\Database;
* @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead
* use \Drupal\Tests\system\Functional\Database\FakeRecord.
*/
class FakeRecord { }
class FakeRecord {}
@@ -4,6 +4,7 @@ namespace Drupal\system\Tests\Form;
use Drupal\Core\Form\FormState;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\system\Functional\Form\StubForm;
/**
* Tests the tableselect form element for expected behavior.
@@ -92,7 +93,7 @@ class ElementsTableSelectTest extends WebTestBase {
// The first two body rows should each have 5 table cells: One for the
// radio, one cell in the first column, one cell in the second column,
// and two cells in the third column which has colspan 2.
for ( $i = 0; $i <= 1; $i++) {
for ($i = 0; $i <= 1; $i++) {
$this->assertEqual(count($table_body[0]->tr[$i]->td), 5, format_string('There are five cells in row @row.', ['@row' => $i]));
}
// The third row should have 3 cells, one for the radio, one spanning the
@@ -28,7 +28,7 @@ class StorageTest extends WebTestBase {
protected function setUp() {
parent::setUp();
$this->drupalLogin ($this->drupalCreateUser());
$this->drupalLogin($this->drupalCreateUser());
}
/**
@@ -89,7 +89,7 @@ class TriggeringElementTest extends WebTestBase {
// Ensure that the triggering element was not set to the restricted button.
// Do this with both a negative and positive assertion, because negative
// assertions alone can be brittle. See testNoButtonInfoInPost() for why the
//triggering element gets set to 'button2'.
// triggering element gets set to 'button2'.
$this->assertNoText('The clicked button is button1.', '$form_state->getTriggeringElement() not set to a restricted button.');
$this->assertText('The clicked button is button2.', '$form_state->getTriggeringElement() not set to a restricted button.');
}
@@ -9,7 +9,6 @@ use Drupal\Core\Site\Settings;
use Drupal\simpletest\InstallerTestBase;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests distribution profile support with existing settings.
*
@@ -25,6 +25,10 @@ class InstallerTest extends InstallerTestBase {
$this->assertRaw(t('Congratulations, you installed @drupal!', [
'@drupal' => drupal_install_profile_distribution_name(),
]));
// Ensure that the timezone is correct for sites under test after installing
// interactively.
$this->assertEqual($this->config('system.date')->get('timezone.default'), 'Australia/Sydney');
}
/**
@@ -2,11 +2,16 @@
namespace Drupal\system\Tests\Menu;
@trigger_error(__NAMESPACE__ . '\AssertBreadcrumbTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait', E_USER_DEPRECATED);
use Drupal\Component\Utility\Html;
use Drupal\Core\Url;
/**
* Provides test assertions for verifying breadcrumbs.
*
* @deprecated Scheduled for removal in Drupal 9.0.0.
* Use \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait instead.
*/
trait AssertBreadcrumbTrait {
@@ -2,10 +2,15 @@
namespace Drupal\system\Tests\Menu;
@trigger_error(__NAMESPACE__ . '\AssertMenuActiveTrailTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Menu\AssertMenuActiveTrailTrait', E_USER_DEPRECATED);
use Drupal\Core\Url;
/**
* Provides test assertions for verifying the active menu trail.
*
* @deprecated Scheduled for removal in Drupal 9.0.0.
* Use \Drupal\Tests\system\Functional\Menu\AssertMenuActiveTrailTrait instead.
*/
trait AssertMenuActiveTrailTrait {
@@ -2,8 +2,16 @@
namespace Drupal\system\Tests\Menu;
@trigger_error(__NAMESPACE__ . '\MenuTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\BrowserTestBase', E_USER_DEPRECATED);
use Drupal\simpletest\WebTestBase;
/**
* Base class for Menu tests.
*
* @deprecated Scheduled for removal in Drupal 9.0.0.
* Use \Drupal\Tests\BrowserTestBase instead.
*/
abstract class MenuTestBase extends WebTestBase {
use AssertBreadcrumbTrait;
@@ -1,6 +1,7 @@
<?php
namespace Drupal\system\Tests\Module;
use Drupal\Component\Utility\Unicode;
/**
@@ -90,6 +91,16 @@ class DependencyTest extends ModuleTestBase {
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
}
/**
* Tests failing PHP version requirements.
*/
public function testIncompatiblePhpVersionDependency() {
$this->drupalGet('admin/modules');
$this->assertRaw('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.', 'User is informed when the PHP dependency requirement of a module is not met.');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_php_version_test][enable]"]');
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
}
/**
* Tests enabling a module that depends on a module which fails hook_requirements().
*/
@@ -275,7 +275,7 @@ class InstallUninstallTest extends ModuleTestBase {
$all_update_functions = $post_update_registry->getPendingUpdateFunctions();
$empty_result = TRUE;
foreach ($all_update_functions as $function) {
list($function_module, ) = explode('_post_update_', $function);
list($function_module,) = explode('_post_update_', $function);
if ($module === $function_module) {
$empty_result = FALSE;
break;
@@ -90,8 +90,10 @@ abstract class ModuleTestBase extends WebTestBase {
* @param string $module
* The name of the module.
*
* @return bool
* TRUE if configuration has been installed, FALSE otherwise.
* @return bool|null
* TRUE if configuration has been installed, FALSE otherwise. Returns NULL
* if the module configuration directory does not exist or does not contain
* any configuration files.
*/
public function assertModuleConfig($module) {
$module_config_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
@@ -282,7 +282,8 @@ class SessionTest extends WebTestBase {
/**
* Reset the cookie file so that it refers to the specified user.
*
* @param $uid User id to set as the active session.
* @param $uid
* User id to set as the active session.
*/
public function sessionReset($uid = 0) {
// Close the internal browser.
@@ -105,9 +105,19 @@ class CronRunTest extends WebTestBase {
// the time will start at 1 January 1970.
$this->assertNoText('years');
$this->drupalPostForm(NULL, [], t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'));
$cron_last = time() - 200;
\Drupal::state()->set('system.cron_last', $cron_last);
$this->drupalPostForm(NULL, [], 'Save configuration');
$this->assertText('The configuration options have been saved.');
$this->assertUrl('admin/config/system/cron');
// Check that cron does not run when saving the configuration form.
$this->assertEqual($cron_last, \Drupal::state()->get('system.cron_last'), 'Cron does not run when saving the configuration form.');
// Check that cron runs when triggered manually.
$this->drupalPostForm(NULL, [], 'Run cron');
$this->assertTrue($cron_last < \Drupal::state()->get('system.cron_last'), 'Cron runs when triggered manually.');
}
/**
@@ -34,8 +34,9 @@ class FloodTest extends WebTestBase {
$window_expired = -1;
$name = 'flood_test_cleanup';
// Register expired event.
$flood = \Drupal::flood();
$this->assertTrue($flood->isAllowed($name, $threshold));
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
$this->assertFalse($flood->isAllowed($name, $threshold));
@@ -62,6 +63,7 @@ class FloodTest extends WebTestBase {
$request_stack = \Drupal::service('request_stack');
$flood = new MemoryBackend($request_stack);
$this->assertTrue($flood->isAllowed($name, $threshold));
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
@@ -90,6 +92,7 @@ class FloodTest extends WebTestBase {
$connection = \Drupal::service('database');
$request_stack = \Drupal::service('request_stack');
$flood = new DatabaseBackend($connection, $request_stack);
$this->assertTrue($flood->isAllowed($name, $threshold));
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
@@ -30,7 +30,7 @@ class FrontPageTest extends WebTestBase {
parent::setUp();
// Create admin user, log in admin user, and create one node.
$this->drupalLogin ($this->drupalCreateUser([
$this->drupalLogin($this->drupalCreateUser([
'access content',
'administer site configuration',
]));
@@ -113,9 +113,9 @@ class PageTitleTest extends WebTestBase {
$this->assertEqual('Test dynamic title', (string) $result[0]);
// Set some custom translated strings.
$this->addCustomTranslations('en', ['' => [
'Static title' => 'Static title translated'
]]);
$this->addCustomTranslations('en', [
'' => ['Static title' => 'Static title translated'],
]);
$this->writeCustomTranslations();
// Ensure that the title got translated.
@@ -2,7 +2,6 @@
namespace Drupal\system\Tests\System;
use Drupal\simpletest\WebTestBase;
/**
@@ -2,6 +2,8 @@
namespace Drupal\system\Tests\Update;
@trigger_error(__NAMESPACE__ . '\DbUpdatesTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use \Drupal\FunctionalTests\Update\DbUpdatesTrait instead. See https://www.drupal.org/node/2896640.', E_USER_DEPRECATED);
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
@@ -10,6 +12,10 @@ use Drupal\Core\Url;
* pending db updates through the Update UI.
*
* This should be used only by classes extending \Drupal\simpletest\WebTestBase.
*
* @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
* Use \Drupal\FunctionalTests\Update\DbUpdatesTrait.
* @see https://www.drupal.org/node/2896640
*/
trait DbUpdatesTrait {
@@ -2,6 +2,8 @@
namespace Drupal\system\Tests\Update;
@trigger_error(__NAMESPACE__ . '\UpdatePathTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use \Drupal\FunctionalTests\Update\UpdatePathTestBase instead. See https://www.drupal.org/node/2896640.', E_USER_DEPRECATED);
use Drupal\Component\Utility\Crypt;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Core\Database\Database;
@@ -34,6 +36,10 @@ use Symfony\Component\HttpFoundation\Request;
*
* @ingroup update_api
*
* @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
* Use \Drupal\FunctionalTests\Update\UpdatePathTestBase.
* @see https://www.drupal.org/node/2896640
*
* @see hook_update_N()
*/
abstract class UpdatePathTestBase extends WebTestBase {
@@ -237,10 +243,14 @@ abstract class UpdatePathTestBase extends WebTestBase {
}
// The site might be broken at the time so logging in using the UI might
// not work, so we use the API itself.
drupal_rewrite_settings(['settings' => ['update_free_access' => (object) [
'value' => TRUE,
'required' => TRUE,
]]]);
drupal_rewrite_settings([
'settings' => [
'update_free_access' => (object) [
'value' => TRUE,
'required' => TRUE,
],
],
]);
$this->drupalGet($this->updateUrl);
$this->clickLink(t('Continue'));
+3 -3
View File
@@ -7,8 +7,8 @@ package: Core
required: true
configure: system.admin_config_system
# 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
+259 -6
View File
@@ -9,10 +9,16 @@ use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\Environment;
use Drupal\Component\FileSystem\FileSystem;
use Drupal\Component\Utility\OpCodeCache;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Path\AliasStorage;
use Drupal\Core\Url;
use Drupal\Core\Database\Database;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Site\Settings;
use Drupal\Core\StreamWrapper\PrivateStream;
use Drupal\Core\StreamWrapper\PublicStream;
@@ -615,7 +621,7 @@ function system_requirements($phase) {
}
}
}
if ($phase != 'install' && (empty($GLOBALS['config_directories']) || empty($GLOBALS['config_directories'][CONFIG_SYNC_DIRECTORY]) )) {
if ($phase != 'install' && (empty($GLOBALS['config_directories']) || empty($GLOBALS['config_directories'][CONFIG_SYNC_DIRECTORY]))) {
$requirements['config directories'] = [
'title' => t('Configuration directories'),
'value' => t('Not present'),
@@ -805,9 +811,46 @@ function system_requirements($phase) {
}
}
// Test Unicode library
include_once DRUPAL_ROOT . '/core/includes/unicode.inc';
$requirements = array_merge($requirements, unicode_requirements());
// Returns Unicode library status and errors.
$libraries = [
Unicode::STATUS_SINGLEBYTE => t('Standard PHP'),
Unicode::STATUS_MULTIBYTE => t('PHP Mbstring Extension'),
Unicode::STATUS_ERROR => t('Error'),
];
$severities = [
Unicode::STATUS_SINGLEBYTE => REQUIREMENT_WARNING,
Unicode::STATUS_MULTIBYTE => NULL,
Unicode::STATUS_ERROR => REQUIREMENT_ERROR,
];
$failed_check = Unicode::check();
$library = Unicode::getStatus();
$requirements['unicode'] = [
'title' => t('Unicode library'),
'value' => $libraries[$library],
'severity' => $severities[$library],
];
switch ($failed_check) {
case 'mb_strlen':
$requirements['unicode']['description'] = t('Operations on Unicode strings are emulated on a best-effort basis. Install the <a href="http://php.net/mbstring">PHP mbstring extension</a> for improved Unicode support.');
break;
case 'mbstring.func_overload':
$requirements['unicode']['description'] = t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini <em>mbstring.func_overload</em> setting. Please refer to the <a href="http://php.net/mbstring">PHP mbstring documentation</a> for more information.');
break;
case 'mbstring.encoding_translation':
$requirements['unicode']['description'] = t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.encoding_translation</em> setting. Please refer to the <a href="http://php.net/mbstring">PHP mbstring documentation</a> for more information.');
break;
case 'mbstring.http_input':
$requirements['unicode']['description'] = t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_input</em> setting. Please refer to the <a href="http://php.net/mbstring">PHP mbstring documentation</a> for more information.');
break;
case 'mbstring.http_output':
$requirements['unicode']['description'] = t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_output</em> setting. Please refer to the <a href="http://php.net/mbstring">PHP mbstring documentation</a> for more information.');
break;
}
if ($phase == 'runtime') {
// Check for update status module.
@@ -854,7 +897,7 @@ function system_requirements($phase) {
$requirements['trusted_host_patterns'] = [
'title' => t('Trusted Host Settings'),
'value' => t('Enabled'),
'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', ['%trusted_host_patterns' => join(', ', $trusted_host_patterns)]),
'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', ['%trusted_host_patterns' => implode(', ', $trusted_host_patterns)]),
];
}
}
@@ -926,6 +969,15 @@ function system_requirements($phase) {
];
}
}
// Check to see if dates will be limited to 1901-2038.
if (PHP_INT_SIZE <= 4) {
$requirements['limited_date_range'] = [
'title' => t('Limited date range'),
'value' => t('Your PHP installation has a limited date range.'),
'description' => t('You are running on a system where PHP is compiled or limited to using 32-bit integers. This will limit the range of dates and timestamps to the years 1901-2038. Read about the <a href=":url">limitations of 32-bit PHP</a>.', [':url' => 'https://www.drupal.org/docs/8/system-requirements/limitations-of-32-bit-php']),
'severity' => REQUIREMENT_WARNING,
];
}
return $requirements;
}
@@ -1486,7 +1538,7 @@ function system_update_8007() {
$schema = \Drupal::keyValue('entity.storage_schema.sql')->getAll();
$schema_copy = $schema;
foreach ($schema as $item_name => $item) {
list($entity_type_id, , ) = explode('.', $item_name);
list($entity_type_id, ,) = explode('.', $item_name);
if (!isset($entity_types[$entity_type_id])) {
continue;
}
@@ -1789,3 +1841,204 @@ function system_update_8301() {
->set('profile', \Drupal::installProfile())
->save();
}
/**
* Move revision metadata fields to the revision table.
*/
function system_update_8400(&$sandbox) {
// Due to the fields from RevisionLogEntityTrait not being explicitly
// mentioned in the storage they might have been installed wrongly in the base
// table for revisionable untranslatable entities and in the data and revision
// data tables for revisionable and translatable entities.
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$database = \Drupal::database();
$database_schema = $database->schema();
if (!isset($sandbox['current'])) {
// This must be the first run. Initialize the sandbox.
$sandbox['current'] = 0;
$definitions = array_filter(\Drupal::entityTypeManager()->getDefinitions(), function (EntityTypeInterface $entity_type) use ($entity_definition_update_manager) {
if ($entity_type = $entity_definition_update_manager->getEntityType($entity_type->id())) {
return is_subclass_of($entity_type->getClass(), FieldableEntityInterface::class) && ($entity_type instanceof ContentEntityTypeInterface) && $entity_type->isRevisionable();
}
return FALSE;
});
$sandbox['entity_type_ids'] = array_keys($definitions);
$sandbox['max'] = count($sandbox['entity_type_ids']);
}
$current_entity_type_key = $sandbox['current'];
for ($i = $current_entity_type_key; ($i < $current_entity_type_key + 1) && ($i < $sandbox['max']); $i++) {
$entity_type_id = $sandbox['entity_type_ids'][$i];
/** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
$entity_type = $entity_definition_update_manager->getEntityType($entity_type_id);
$base_fields = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions($entity_type_id);
$revision_metadata_fields = $entity_type->getRevisionMetadataKeys();
$fields_to_update = array_intersect_key($base_fields, array_flip($revision_metadata_fields));
if (!empty($fields_to_update)) {
// Initialize the entity table names.
// @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage::initTableLayout()
$base_table = $entity_type->getBaseTable() ?: $entity_type_id;
$data_table = $entity_type->getDataTable() ?: $entity_type_id . '_field_data';
$revision_table = $entity_type->getRevisionTable() ?: $entity_type_id . '_revision';
$revision_data_table = $entity_type->getRevisionDataTable() ?: $entity_type_id . '_field_revision';
$revision_field = $entity_type->getKey('revision');
// No data needs to be migrated if the entity type is not translatable.
if ($entity_type->isTranslatable()) {
if (!isset($sandbox[$entity_type_id])) {
// This must be the first run for this entity type. Initialize the
// sub-sandbox for it.
// Calculate the number of revisions to process.
$count = \Drupal::entityQuery($entity_type_id)
->allRevisions()
->count()
->accessCheck(FALSE)
->execute();
$sandbox[$entity_type_id]['current'] = 0;
$sandbox[$entity_type_id]['max'] = $count;
}
// Define the step size.
$steps = Settings::get('entity_update_batch_size', 50);
// Collect the revision IDs to process.
$revisions = \Drupal::entityQuery($entity_type_id)
->allRevisions()
->range($sandbox[$entity_type_id]['current'], $sandbox[$entity_type_id]['current'] + $steps)
->sort($revision_field, 'ASC')
->accessCheck(FALSE)
->execute();
$revisions = array_keys($revisions);
foreach ($fields_to_update as $revision_metadata_field_name => $definition) {
// If the revision metadata field is present in the data and the
// revision data table, install its definition again with the updated
// storage code in order for the field to be installed in the
// revision table. Afterwards, copy over the field values and remove
// the field from the data and the revision data tables.
if ($database_schema->fieldExists($data_table, $revision_metadata_field_name) && $database_schema->fieldExists($revision_data_table, $revision_metadata_field_name)) {
// Install the field in the revision table.
if (!isset($sandbox[$entity_type_id]['storage_definition_installed'][$revision_metadata_field_name])) {
$entity_definition_update_manager->installFieldStorageDefinition($revision_metadata_field_name, $entity_type_id, $entity_type->getProvider(), $definition);
$sandbox[$entity_type_id]['storage_definition_installed'][$revision_metadata_field_name] = TRUE;
}
// Apply the field value from the revision data table to the
// revision table.
foreach ($revisions as $rev_id) {
$field_value = $database->select($revision_data_table, 't')
->fields('t', [$revision_metadata_field_name])
->condition($revision_field, $rev_id)
->execute()
->fetchField();
$database->update($revision_table)
->condition($revision_field, $rev_id)
->fields([$revision_metadata_field_name => $field_value])
->execute();
}
}
}
$sandbox[$entity_type_id]['current'] += count($revisions);
$sandbox[$entity_type_id]['finished'] = ($sandbox[$entity_type_id]['current'] == $sandbox[$entity_type_id]['max']) || empty($revisions);
if ($sandbox[$entity_type_id]['finished']) {
foreach ($fields_to_update as $revision_metadata_field_name => $definition) {
// Drop the field from the data and revision data tables.
$database_schema->dropField($data_table, $revision_metadata_field_name);
$database_schema->dropField($revision_data_table, $revision_metadata_field_name);
}
$sandbox['current']++;
}
}
else {
foreach ($fields_to_update as $revision_metadata_field_name => $definition) {
if ($database_schema->fieldExists($base_table, $revision_metadata_field_name)) {
// Install the field in the revision table.
$entity_definition_update_manager->installFieldStorageDefinition($revision_metadata_field_name, $entity_type_id, $entity_type->getProvider(), $definition);
// Drop the field from the base table.
$database_schema->dropField($base_table, $revision_metadata_field_name);
}
}
$sandbox['current']++;
}
}
else {
$sandbox['current']++;
}
}
$sandbox['#finished'] = $sandbox['current'] == $sandbox['max'];
}
/**
* Remove response.gzip (and response) from system module configuration.
*/
function system_update_8401() {
\Drupal::configFactory()->getEditable('system.performance')
->clear('response.gzip')
->clear('response')
->save();
}
/**
* Add the 'revision_translation_affected' field to all entity types.
*/
function system_update_8402() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
// Clear the cached entity type definitions so we get the new
// 'revision_translation_affected' entity key.
\Drupal::entityTypeManager()->clearCachedDefinitions();
// Get a list of revisionable and translatable entity types.
/** @var \Drupal\Core\Entity\ContentEntityTypeInterface[] $definitions */
$definitions = array_filter(\Drupal::entityTypeManager()->getDefinitions(), function (EntityTypeInterface $entity_type) use ($definition_update_manager) {
if ($entity_type = $definition_update_manager->getEntityType($entity_type->id())) {
return $entity_type->isRevisionable() && $entity_type->isTranslatable();
}
return FALSE;
});
foreach ($definitions as $entity_type_id => $entity_type) {
$field_name = $entity_type->getKey('revision_translation_affected');
// Install the 'revision_translation_affected' field if needed.
if (!$definition_update_manager->getFieldStorageDefinition($field_name, $entity_type_id)) {
$storage_definition = BaseFieldDefinition::create('boolean')
->setLabel(t('Revision translation affected'))
->setDescription(t('Indicates if the last edit of a translation belongs to current revision.'))
->setReadOnly(TRUE)
->setRevisionable(TRUE)
->setTranslatable(TRUE)
// Mark all pre-existing revisions as affected in order to be consistent
// with the previous API return value: if the field was not defined the
// value returned was always TRUE.
->setInitialValue(TRUE);
$definition_update_manager
->installFieldStorageDefinition($field_name, $entity_type_id, $entity_type_id, $storage_definition);
}
}
}
/**
* Delete all cache_* tables. They are recreated on demand with the new schema.
*/
function system_update_8403() {
foreach (Cache::getBins() as $bin => $cache_backend) {
// Try to delete the table regardless of which cache backend is handling it.
// This is to ensure the new schema is used if the configuration for the
// backend class is changed after the update hook runs.
$table_name = "cache_$bin";
$schema = Database::getConnection()->schema();
if ($schema->tableExists($table_name)) {
$schema->dropTable($table_name);
}
}
}
+38 -4
View File
@@ -33,6 +33,8 @@ use GuzzleHttp\Exception\RequestException;
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::TIMEZONE_DEFAULT instead.
*
* @see https://www.drupal.org/node/2831620
*/
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
@@ -41,6 +43,8 @@ const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::TIMEZONE_EMPTY instead.
*
* @see https://www.drupal.org/node/2831620
*/
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
@@ -49,6 +53,8 @@ const DRUPAL_USER_TIMEZONE_EMPTY = 1;
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::TIMEZONE_SELECT instead.
*
* @see https://www.drupal.org/node/2831620
*/
const DRUPAL_USER_TIMEZONE_SELECT = 2;
@@ -74,6 +80,7 @@ const DRUPAL_REQUIRED = 2;
* Use \Drupal\block\BlockRepositoryInterface::REGIONS_VISIBLE instead.
*
* @see system_region_list()
* @see https://www.drupal.org/node/2831620
*/
const REGIONS_VISIBLE = 'visible';
@@ -84,6 +91,7 @@ const REGIONS_VISIBLE = 'visible';
* Use \Drupal\block\BlockRepositoryInterface::REGIONS_ALL instead.
*
* @see system_region_list()
* @see https://www.drupal.org/node/2831620
*/
const REGIONS_ALL = 'all';
@@ -603,7 +611,7 @@ function system_page_attachments(array &$page) {
}
// Get the major Drupal version.
list($version, ) = explode('.', \Drupal::VERSION);
list($version,) = explode('.', \Drupal::VERSION);
// Attach default meta tags.
$meta_default = [
@@ -845,7 +853,7 @@ function system_user_timezone(&$form, FormStateInterface $form_state) {
'#type' => 'select',
'#title' => t('Time zone'),
'#default_value' => $account->getTimezone() ? $account->getTimezone() : \Drupal::config('system.date')->get('timezone.default'),
'#options' => system_time_zones($account->id() != $user->id()),
'#options' => system_time_zones($account->id() != $user->id(), TRUE),
'#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
];
$user_input = $form_state->getUserInput();
@@ -1355,10 +1363,15 @@ function system_mail($key, &$message, $params) {
/**
* Generate an array of time zones and their local time&date.
*
* @param $blank
* @param mixed $blank
* If evaluates true, prepend an empty time zone option to the array.
* @param bool $grouped
* (optional) Whether the timezones should be grouped by region.
*
* @return array
* An array or nested array containing time zones, keyed by the system name.
*/
function system_time_zones($blank = NULL) {
function system_time_zones($blank = NULL, $grouped = FALSE) {
$zonelist = timezone_identifiers_list();
$zones = $blank ? ['' => t('- None selected -')] : [];
foreach ($zonelist as $zone) {
@@ -1371,6 +1384,27 @@ function system_time_zones($blank = NULL) {
}
// Sort the translated time zones alphabetically.
asort($zones);
if ($grouped) {
$grouped_zones = [];
foreach ($zones as $key => $value) {
$split = explode('/', $value);
$city = array_pop($split);
$region = array_shift($split);
if (!empty($region)) {
$grouped_zones[$region][$key] = empty($split) ? $city : $city . ' (' . implode('/', $split) . ')';
}
else {
$grouped_zones[$key] = $value;
}
}
foreach ($grouped_zones as $key => $value) {
if (is_array($grouped_zones[$key])) {
asort($grouped_zones[$key]);
}
}
$zones = $grouped_zones;
}
return $zones;
}
@@ -65,3 +65,19 @@ function system_post_update_hashes_clear_cache() {
function system_post_update_timestamp_plugins() {
// Empty post-update hook.
}
/**
* Clear caches to ensure Classy's message library is always added.
*/
function system_post_update_classy_message_library() {
// Empty post-update hook.
}
/**
* Force field type plugin definitions to be cleared.
*
* @see https://www.drupal.org/node/2403703
*/
function system_post_update_field_type_plugins() {
// Empty post-update hook.
}
+8
View File
@@ -22,6 +22,14 @@ system.404:
requirements:
_access: 'TRUE'
system.4xx:
path: '/system/4xx'
defaults:
_controller: '\Drupal\system\Controller\Http4xxController:on4xx'
_title: 'Client error'
requirements:
_access: 'TRUE'
system.admin:
path: '/admin'
defaults:
+1 -1
View File
@@ -12,7 +12,7 @@ services:
arguments: ['@module_handler', '@entity.manager', '@request_stack', '@menu.link_tree', '@menu.active_trail']
system.breadcrumb.default:
class: Drupal\system\PathBasedBreadcrumbBuilder
arguments: ['@router.request_context', '@access_manager', '@router', '@path_processor_manager', '@config.factory', '@title_resolver', '@current_user', '@path.current']
arguments: ['@router.request_context', '@access_manager', '@router', '@path_processor_manager', '@config.factory', '@title_resolver', '@current_user', '@path.current', '@path.matcher']
tags:
- { name: breadcrumb_builder, priority: 0 }
path_processor.files:
@@ -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());
@@ -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();
@@ -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();
@@ -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();
}
@@ -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: { }
@@ -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: { }
@@ -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.
*/
@@ -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) {}
}
@@ -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.
}
}
@@ -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.
@@ -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

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