updated core to 8.6.1 via composer

This commit is contained in:
2018-09-12 13:58:26 +02:00
parent a9a219f2ed
commit ea56b9fba3
4443 changed files with 112098 additions and 40708 deletions
+1 -1
View File
@@ -286,7 +286,7 @@ function views_ui_build_form_url(FormStateInterface $form_state) {
$route_parameters = [
'js' => $ajax,
'view' => $name,
'display_id' => $display_id
'display_id' => $display_id,
];
$url = Url::fromRoute($route_name, $route_parameters);
if ($type = $form_state->get('type')) {
+82 -40
View File
@@ -3,7 +3,7 @@
* Handles AJAX submission and response in Views UI.
*/
(function ($, Drupal, drupalSettings) {
(function($, Drupal, drupalSettings) {
/**
* Ajax command for highlighting elements.
*
@@ -16,7 +16,11 @@
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) {
Drupal.AjaxCommands.prototype.viewsHighlight = function(
ajax,
response,
status,
) {
$('.hilited').removeClass('hilited');
$(response.selector).addClass('hilited');
};
@@ -31,16 +35,22 @@
* @param {string} [status]
* The XHR status code?
*/
Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) {
Drupal.AjaxCommands.prototype.viewsSetForm = function(
ajax,
response,
status,
) {
const $form = $('.js-views-ui-dialog form');
// Identify the button that was clicked so that .ajaxSubmit() can use it.
// We need to do this for both .click() and .mousedown() since JavaScript
// code might trigger either behavior.
const $submitButtons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
$submitButtons.on('click mousedown', function () {
const $submitButtons = $form
.find('input[type=submit].js-form-submit, button.js-form-submit')
.once('views-ajax-submit');
$submitButtons.on('click mousedown', function() {
this.form.clk = this;
});
$form.once('views-ajax-submit').each(function () {
$form.once('views-ajax-submit').each(function() {
const $form = $(this);
const elementSettings = {
url: response.url,
@@ -65,7 +75,11 @@
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) {
Drupal.AjaxCommands.prototype.viewsShowButtons = function(
ajax,
response,
status,
) {
$('div.views-edit-view div.form-actions').removeClass('js-hide');
if (response.changed) {
$('div.views-edit-view div.view-changed.messages').removeClass('js-hide');
@@ -82,7 +96,11 @@
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) {
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function(
ajax,
response,
status,
) {
if ($('input#edit-displays-live-preview').is(':checked')) {
$('#preview-submit').trigger('click');
}
@@ -102,7 +120,11 @@
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) {
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function(
ajax,
response,
status,
) {
const doc = document;
// For the <title> element, make a best-effort attempt to replace the page
// title and leave the site name alone. If the theme doesn't use the site
@@ -110,9 +132,15 @@
const oldTitle = doc.title;
// Escape the site name, in case it has special characters in it, so we can
// use it in our regex.
const escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
const escapedSiteName = response.siteName.replace(
/[-[\]{}()*+?.,\\^$|#\s]/g,
'\\$&',
);
const re = new RegExp(`.+ (.) ${escapedSiteName}`);
doc.title = oldTitle.replace(re, `${response.title} $1 ${response.siteName}`);
doc.title = oldTitle.replace(
re,
`${response.title} $1 ${response.siteName}`,
);
$('h1.page-title').text(response.title);
};
@@ -123,7 +151,7 @@
* @return {Array}
* An array of messages. Always empty array, to get rid of the messages.
*/
Drupal.theme.tableDragChangedWarning = function () {
Drupal.theme.tableDragChangedWarning = function() {
return [];
};
@@ -138,11 +166,13 @@
*/
Drupal.behaviors.livePreview = {
attach(context) {
$('input#edit-displays-live-preview', context).once('views-ajax').on('click', function () {
if ($(this).is(':checked')) {
$('#preview-submit').trigger('click');
}
});
$('input#edit-displays-live-preview', context)
.once('views-ajax')
.on('click', function() {
if ($(this).is(':checked')) {
$('#preview-submit').trigger('click');
}
});
},
};
@@ -156,13 +186,15 @@
*/
Drupal.behaviors.syncPreviewDisplay = {
attach(context) {
$('#views-tabset a').once('views-ajax').on('click', function () {
const href = $(this).attr('href');
// Cut of #views-tabset.
const displayId = href.substr(11);
// Set the form element.
$('#views-live-preview #preview-display-id').val(displayId);
});
$('#views-tabset a')
.once('views-ajax')
.on('click', function() {
const href = $(this).attr('href');
// Cut of #views-tabset.
const displayId = href.substr(11);
// Set the form element.
$('#views-live-preview #preview-display-id').val(displayId);
});
},
};
@@ -182,19 +214,22 @@
progress: { type: 'fullscreen' },
};
// Bind AJAX behaviors to all items showing the class.
$('a.views-ajax-link', context).once('views-ajax').each(function () {
const elementSettings = baseElementSettings;
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
// Set the URL to go to the anchor.
if ($(this).attr('href')) {
elementSettings.url = $(this).attr('href');
}
Drupal.ajax(elementSettings);
});
$('a.views-ajax-link', context)
.once('views-ajax')
.each(function() {
const elementSettings = baseElementSettings;
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
// Set the URL to go to the anchor.
if ($(this).attr('href')) {
elementSettings.url = $(this).attr('href');
}
Drupal.ajax(elementSettings);
});
$('div#views-live-preview a')
.once('views-ajax').each(function () {
.once('views-ajax')
.each(function() {
// We don't bind to links without a URL.
if (!$(this).attr('href')) {
return true;
@@ -203,7 +238,10 @@
const elementSettings = baseElementSettings;
// Set the URL to go to the anchor.
elementSettings.url = $(this).attr('href');
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
if (
Drupal.Views.getPath(elementSettings.url).substring(0, 21) !==
'admin/structure/views'
) {
return true;
}
@@ -219,15 +257,19 @@
// @todo Revisit this after fixing Views UI to display a Preview outside
// of the main Edit form.
$('div#views-live-preview input[type=submit]')
.once('views-ajax').each(function (event) {
$(this).on('click', function () {
.once('views-ajax')
.each(function(event) {
$(this).on('click', function() {
this.form.clk = this;
return true;
});
const elementSettings = baseElementSettings;
// Set the URL to go to the anchor.
elementSettings.url = $(this.form).attr('action');
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
if (
Drupal.Views.getPath(elementSettings.url).substring(0, 21) !==
'admin/structure/views'
) {
return true;
}
@@ -241,4 +283,4 @@
});
},
};
}(jQuery, Drupal, drupalSettings));
})(jQuery, Drupal, drupalSettings);
+19 -8
View File
@@ -3,7 +3,7 @@
* Views dialog behaviors.
*/
(function ($, Drupal, drupalSettings) {
(function($, Drupal, drupalSettings) {
function handleDialogResize(e) {
const $modal = $(e.currentTarget);
const $viewsOverride = $modal.find('[data-drupal-views-offset]');
@@ -16,7 +16,7 @@
// Let scroll element take all the height available.
$scroll.css({ overflow: 'visible', height: 'auto' });
modalHeight = $modal.height();
$viewsOverride.each(function () {
$viewsOverride.each(function() {
offset += $(this).outerHeight();
});
@@ -41,16 +41,27 @@
*/
Drupal.behaviors.viewsModalContent = {
attach(context) {
$('body').once('viewsDialog').on('dialogContentResize.viewsDialog', '.ui-dialog-content', handleDialogResize);
$('body')
.once('viewsDialog')
.on(
'dialogContentResize.viewsDialog',
'.ui-dialog-content',
handleDialogResize,
);
// When expanding details, make sure the modal is resized.
$(context).find('.scroll').once('detailsUpdate').on('click', 'summary', (e) => {
$(e.currentTarget).trigger('dialogContentResize');
});
$(context)
.find('.scroll')
.once('detailsUpdate')
.on('click', 'summary', e => {
$(e.currentTarget).trigger('dialogContentResize');
});
},
detach(context, settings, trigger) {
if (trigger === 'unload') {
$('body').removeOnce('viewsDialog').off('.viewsDialog');
$('body')
.removeOnce('viewsDialog')
.off('.viewsDialog');
}
},
};
}(jQuery, Drupal, drupalSettings));
})(jQuery, Drupal, drupalSettings);
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
* Views listing behaviors.
*/
(function ($, Drupal) {
(function($, Drupal) {
/**
* Filters the view listing tables by a text input search string.
*
@@ -23,20 +23,27 @@
let $rows;
function filterViewList(e) {
const query = $(e.target).val().toLowerCase();
const query = $(e.target)
.val()
.toLowerCase();
function showViewRow(index, row) {
const $row = $(row);
const $sources = $row.find('[data-drupal-selector="views-table-filter-text-source"]');
const textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
const $sources = $row.find(
'[data-drupal-selector="views-table-filter-text-source"]',
);
const textMatch =
$sources
.text()
.toLowerCase()
.indexOf(query) !== -1;
$row.closest('tr').toggle(textMatch);
}
// Filter if the length of the query is at least 2 characters.
if (query.length >= 2) {
$rows.each(showViewRow);
}
else {
} else {
$rows.show();
}
}
@@ -47,4 +54,4 @@
}
},
};
}(jQuery, Drupal));
})(jQuery, Drupal);
@@ -78,7 +78,7 @@ class AdvancedSettingsForm extends ConfigFormBase {
'#default_value' => array_filter($config->get('display_extenders')),
'#options' => $options,
'#type' => 'checkboxes',
'#description' => $this->t('Select extensions of the views interface.')
'#description' => $this->t('Select extensions of the views interface.'),
];
}
@@ -103,7 +103,7 @@ class AdvancedSettingsForm extends ConfigFormBase {
*/
public function cacheSubmit() {
views_invalidate_cache();
drupal_set_message($this->t('The cache has been cleared.'));
$this->messenger()->addStatus($this->t('The cache has been cleared.'));
}
}
@@ -2,7 +2,7 @@
namespace Drupal\views_ui\Form\Ajax;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\views\ViewEntityInterface;
@@ -85,7 +85,7 @@ class Rearrange extends ViewsFormBase {
'action' => 'order',
'relationship' => 'sibling',
'group' => 'weight',
]
],
],
'#tree' => TRUE,
'#prefix' => '<div class="scroll" data-drupal-views-scroll>',
@@ -126,7 +126,7 @@ class Rearrange extends ViewsFormBase {
'#id' => 'views-removed-' . $id,
'#attributes' => ['class' => ['views-remove-checkbox']],
'#default_value' => 0,
'#suffix' => \Drupal::l(SafeMarkup::format('<span>@text</span>', ['@text' => $this->t('Remove')]),
'#suffix' => \Drupal::l(new FormattableMarkup('<span>@text</span>', ['@text' => $this->t('Remove')]),
Url::fromRoute('<none>', [], [
'attributes' => [
'id' => 'views-remove-link-' . $id,
@@ -2,7 +2,7 @@
namespace Drupal\views_ui\Form\Ajax;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
@@ -44,7 +44,7 @@ class ReorderDisplays extends ViewsFormBase {
]);
$form['view'] = [
'#type' => 'value',
'#value' => $view
'#value' => $view,
];
$displays = $view->get('display');
@@ -68,7 +68,7 @@ class ReorderDisplays extends ViewsFormBase {
'action' => 'order',
'relationship' => 'sibling',
'group' => 'weight',
]
],
],
'#tree' => TRUE,
'#prefix' => '<div class="scroll" data-drupal-views-scroll>',
@@ -117,7 +117,7 @@ class ReorderDisplays extends ViewsFormBase {
],
'link' => [
'#type' => 'link',
'#title' => SafeMarkup::format('<span>@text</span>', ['@text' => $this->t('Remove')]),
'#title' => new FormattableMarkup('<span>@text</span>', ['@text' => $this->t('Remove')]),
'#url' => Url::fromRoute('<none>'),
'#attributes' => [
'id' => 'display-remove-link-' . $id,
@@ -110,7 +110,7 @@ class BreakLockForm extends EntityConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->tempStore->delete($this->entity->id());
$form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
drupal_set_message($this->t('The lock has been broken and you may now edit this view.'));
$this->messenger()->addStatus($this->t('The lock has been broken and you may now edit this view.'));
}
}
@@ -105,7 +105,13 @@ class PreviewTest extends UITestBase {
$this->assertText(t('Query execute time'));
$this->assertText(t('View render time'));
$this->assertRaw('<strong>Query</strong>');
$this->assertText("SELECT views_test_data.name AS views_test_data_name\nFROM \n{views_test_data} views_test_data\nWHERE (views_test_data.id = &#039;100&#039; )");
$query_string = <<<SQL
SELECT views_test_data.name AS views_test_data_name
FROM
{views_test_data} views_test_data
WHERE (views_test_data.id = '100')
SQL;
$this->assertEscaped($query_string);
// Test that the statistics and query are rendered above the preview.
$this->assertTrue(strpos($this->getRawContent(), 'views-query-info') < strpos($this->getRawContent(), 'view-test-preview'), 'Statistics shown above the preview.');
@@ -34,13 +34,13 @@ class RowUITest extends UITestBase {
$this->assertFieldByName('row[type]', 'fields', 'The default row plugin selected in the UI should be fields.');
$edit = [
'row[type]' => 'test_row'
'row[type]' => 'test_row',
];
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->assertFieldByName('row_options[test_option]', NULL, 'Make sure the custom settings form from the test plugin appears.');
$random_name = $this->randomMachineName();
$edit = [
'row_options[test_option]' => $random_name
'row_options[test_option]' => $random_name,
];
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->drupalGet($row_options_url);
+2 -2
View File
@@ -184,12 +184,12 @@ class ViewAddForm extends ViewFormBase {
}
// @todo Figure out whether it really makes sense to throw and catch exceptions on the wizard.
catch (WizardException $e) {
drupal_set_message($e->getMessage(), 'error');
$this->messenger()->addError($e->getMessage());
$form_state->setRedirect('entity.view.collection');
return;
}
$this->entity->save();
drupal_set_message($this->t('The view %name has been saved.', ['%name' => $form_state->getValue('label')]));
$this->messenger()->addStatus($this->t('The view %name has been saved.', ['%name' => $form_state->getValue('label')]));
$form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
}
+5 -5
View File
@@ -3,7 +3,7 @@
namespace Drupal\views_ui;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\ReplaceCommand;
@@ -325,7 +325,7 @@ class ViewEditForm extends ViewFormBase {
$view->save();
drupal_set_message($this->t('The view %name has been saved.', ['%name' => $view->label()]));
$this->messenger()->addStatus($this->t('The view %name has been saved.', ['%name' => $view->label()]));
// Remove this view from cache so we can edit it properly.
$this->tempStore->delete($view->id());
@@ -1098,7 +1098,7 @@ class ViewEditForm extends ViewFormBase {
$build['fields'][$id]['#class'][] = Html::cleanCssIdentifier($display['id'] . '-' . $type . '-' . $id);
if ($executable->display_handler->useGroupBy() && $handler->usesGroupBy()) {
$build['fields'][$id]['#settings_links'][] = $this->l(SafeMarkup::format('<span class="label">@text</span>', ['@text' => $this->t('Aggregation settings')]), new Url('views_ui.form_handler_group', [
$build['fields'][$id]['#settings_links'][] = $this->l(new FormattableMarkup('<span class="label">@text</span>', ['@text' => $this->t('Aggregation settings')]), new Url('views_ui.form_handler_group', [
'js' => 'nojs',
'view' => $view->id(),
'display_id' => $display['id'],
@@ -1108,7 +1108,7 @@ class ViewEditForm extends ViewFormBase {
}
if ($handler->hasExtraOptions()) {
$build['fields'][$id]['#settings_links'][] = $this->l(SafeMarkup::format('<span class="label">@text</span>', ['@text' => $this->t('Settings')]), new Url('views_ui.form_handler_extra', [
$build['fields'][$id]['#settings_links'][] = $this->l(new FormattableMarkup('<span class="label">@text</span>', ['@text' => $this->t('Settings')]), new Url('views_ui.form_handler_extra', [
'js' => 'nojs',
'view' => $view->id(),
'display_id' => $display['id'],
@@ -1147,7 +1147,7 @@ class ViewEditForm extends ViewFormBase {
foreach ($contents as $key => $pid) {
if ($key != $last) {
$operator = $group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND');
$store[$pid]['#link'] = SafeMarkup::format('@link <span>@operator</span>', ['@link' => $store[$pid]['#link'], '@operator' => $operator]);
$store[$pid]['#link'] = new FormattableMarkup('@link <span>@operator</span>', ['@link' => $store[$pid]['#link'], '@operator' => $operator]);
}
$build['fields'][$pid] = $store[$pid];
}
@@ -178,6 +178,14 @@ class ViewListBuilder extends ConfigEntityListBuilder {
}
}
// ajax.js focuses automatically on the data-drupal-selector element. When
// enabling the view again, focusing on the disable link doesn't work, as it
// is hidden. We assign data-drupal-selector to every link, so it focuses
// on the edit link.
foreach ($operations as &$operation) {
$operation['attributes']['data-drupal-selector'] = 'views-listing-' . $entity->id();
}
return $operations;
}
@@ -77,7 +77,7 @@ class ViewPreviewForm extends ViewFormBase {
return [
'#attributes' => [
'id' => 'preview-submit-wrapper',
'class' => ['preview-submit-wrapper']
'class' => ['preview-submit-wrapper'],
],
'button' => [
'#type' => 'submit',
+3 -3
View File
@@ -713,7 +713,7 @@ class ViewUI implements ViewEntityInterface {
'data' => [
'#markup' => $path,
],
]
],
];
}
if ($show_stats) {
@@ -790,7 +790,7 @@ class ViewUI implements ViewEntityInterface {
else {
foreach ($errors as $display_errors) {
foreach ($display_errors as $error) {
drupal_set_message($error, 'error');
\Drupal::messenger()->addError($error);
}
}
$preview = ['#markup' => t('Unable to preview due to validation errors.')];
@@ -859,7 +859,7 @@ class ViewUI implements ViewEntityInterface {
*/
public function cacheSet() {
if ($this->isLocked()) {
drupal_set_message(t('Changes cannot be made to a locked view.'), 'error');
\Drupal::messenger()->addError(t('Changes cannot be made to a locked view.'));
return;
}
@@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views_ui
- drupal:views_ui
@@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views_ui
- drupal:views_ui
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\views\Views;
/**
@@ -97,8 +97,8 @@ class CustomBooleanTest extends UITestBase {
$view = Views::getView('test_view');
$output = $view->preview();
$output = \Drupal::service('renderer')->renderRoot($output);
$this->{$values['test']}(strpos($output, $values['true']), SafeMarkup::format('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
$this->{$values['test']}(strpos($output, $values['false']), SafeMarkup::format('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
$this->{$values['test']}(strpos($output, $values['true']), new FormattableMarkup('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
$this->{$values['test']}(strpos($output, $values['false']), new FormattableMarkup('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
}
}
@@ -169,8 +169,8 @@ class CustomBooleanTest extends UITestBase {
$view = Views::getView('test_view');
$output = $view->preview();
$output = \Drupal::service('renderer')->renderRoot($output);
$this->{$values['test']}(strpos($output, $values['true']), SafeMarkup::format('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
$this->{$values['test']}(strpos($output, $values['false']), SafeMarkup::format('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
$this->{$values['test']}(strpos($output, $values['true']), new FormattableMarkup('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
$this->{$values['test']}(strpos($output, $values['false']), new FormattableMarkup('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
// Assert that we are using the correct template.
$this->assertContains('llama', (string) $output);
@@ -208,7 +208,7 @@ class DisplayPathTest extends UITestBase {
$edit = [
'title[0][value]' => 'Menu title',
'link[0][uri]' => '/admin/foo',
'menu_parent' => 'admin:system.admin'
'menu_parent' => 'admin:system.admin',
];
$this->drupalPostForm('admin/structure/menu/manage/admin/add', $edit, t('Save'));
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\views\Entity\View;
use Drupal\views\Views;
@@ -45,7 +45,7 @@ class DisplayTest extends UITestBase {
*/
public function testReorderDisplay() {
$view = [
'block[create]' => TRUE
'block[create]' => TRUE,
];
$view = $this->randomView($view);
@@ -60,7 +60,7 @@ class DisplayTest extends UITestBase {
// Put the block display in front of the page display.
$edit = [
'displays[page_1][weight]' => 2,
'displays[block_1][weight]' => 1
'displays[block_1][weight]' => 1,
];
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->drupalPostForm(NULL, [], t('Save'));
@@ -136,7 +136,7 @@ class DisplayTest extends UITestBase {
// Assert that the expected text is found in each area category.
foreach ($areas as $type) {
$element = $this->xpath('//div[contains(@class, :class)]/div', [':class' => $type]);
$this->assertEqual($element[0]->getHtml(), SafeMarkup::format('The selected display type does not use @type plugins', ['@type' => $type]));
$this->assertEqual($element[0]->getHtml(), new FormattableMarkup('The selected display type does not use @type plugins', ['@type' => $type]));
}
}
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\views\Tests\ViewTestData;
@@ -53,7 +53,7 @@ class HandlerTest extends UITestBase {
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0
'default' => 0,
];
return $schema;
@@ -74,8 +74,8 @@ class HandlerTest extends UITestBase {
'relationship' => [
'id' => 'standard',
'base' => 'users_field_data',
'base field' => 'uid'
]
'base field' => 'uid',
],
];
// Create a dummy field with no help text.
@@ -180,14 +180,14 @@ class HandlerTest extends UITestBase {
'field_name' => 'field_test',
'entity_type' => 'node',
'bundle' => 'page',
'label' => 'The giraffe" label'
'label' => 'The giraffe" label',
])->save();
FieldConfig::create([
'field_name' => 'field_test',
'entity_type' => 'node',
'bundle' => 'article',
'label' => 'The <em>giraffe"</em> label <script>alert("the return of the xss")</script>'
'label' => 'The <em>giraffe"</em> label <script>alert("the return of the xss")</script>',
])->save();
$this->drupalGet('admin/structure/views/nojs/add-handler/content/default/field');
@@ -206,7 +206,7 @@ class HandlerTest extends UITestBase {
$href = "admin/structure/views/nojs/handler/test_view_broken/default/$type/id_broken";
$result = $this->xpath('//a[contains(@href, :href)]', [':href' => $href]);
$this->assertEqual(count($result), 1, SafeMarkup::format('Handler (%type) edit link found.', ['%type' => $type]));
$this->assertEqual(count($result), 1, new FormattableMarkup('Handler (%type) edit link found.', ['%type' => $type]));
$text = 'Broken/missing handler';
@@ -225,7 +225,7 @@ class HandlerTest extends UITestBase {
];
foreach ($original_configuration as $key => $value) {
$this->assertText(SafeMarkup::format('@key: @value', ['@key' => $key, '@value' => $value]));
$this->assertText(new FormattableMarkup('@key: @value', ['@key' => $key, '@value' => $value]));
}
}
}
@@ -33,13 +33,13 @@ class StyleUITest extends UITestBase {
$this->assertFieldByName('style[type]', 'default', 'The default style plugin selected in the UI should be unformatted list.');
$edit = [
'style[type]' => 'test_style'
'style[type]' => 'test_style',
];
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->assertFieldByName('style_options[test_option]', NULL, 'Make sure the custom settings form from the test plugin appears.');
$random_name = $this->randomMachineName();
$edit = [
'style_options[test_option]' => $random_name
'style_options[test_option]' => $random_name,
];
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->drupalGet($style_options_url);
@@ -76,8 +76,8 @@ abstract class UITestBase extends ViewTestBase {
$url = $this->buildUrl($path, $options);
// Ensure that each nojs page is accessible via ajax as well.
if (strpos($url, 'nojs') !== FALSE) {
$url = str_replace('nojs', 'ajax', $url);
if (strpos($url, '/nojs/') !== FALSE) {
$url = preg_replace('|/nojs/|', '/ajax/', $url, 1);
$result = $this->drupalGet($url, $options);
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals('application/json', $this->getSession()->getResponseHeader('Content-Type'));
@@ -76,7 +76,7 @@ class ViewsUITourTest extends TourTestBase {
foreach ($handler_titles as $handler_title) {
// Create source string.
$source = $this->localeStorage->createString([
'source' => $handler_title
'source' => $handler_title,
]);
$source->save();
$this->createTranslation($source, $langcode);
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\simpletest\NodeCreationTrait;
use Drupal\views\Entity\View;
use Drupal\views\Tests\ViewTestData;
@@ -12,7 +12,7 @@ use Drupal\views\Tests\ViewTestData;
*
* @group views_ui
*/
class DisplayTest extends JavascriptTestBase {
class DisplayTest extends WebDriverTestBase {
use NodeCreationTrait;
@@ -2,14 +2,14 @@
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the View UI filter criteria group dialog.
*
* @group views_ui
*/
class FilterCriteriaTest extends JavascriptTestBase {
class FilterCriteriaTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -2,14 +2,14 @@
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JavaScript filtering of options in add handler form.
*
* @group views_ui
*/
class FilterOptionsTest extends JavascriptTestBase {
class FilterOptionsTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -2,14 +2,14 @@
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JavaScript library caching on consecutive requests.
*
* @group views_ui
*/
class LibraryCachingTest extends JavascriptTestBase {
class LibraryCachingTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JavaScript filtering on the Views listing page.
@@ -10,7 +10,7 @@ use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
* @see core/modules/views_ui/js/views_ui.listing.js
* @group views_ui
*/
class ViewsListingTest extends JavascriptTestBase {
class ViewsListingTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -92,6 +92,7 @@ class ViewsListingTest extends JavascriptTestBase {
// Disable a View and see if it moves to the disabled listing.
$enabled_view = $page->find('css', 'tr.views-ui-list-enabled');
$view_description = $enabled_view->find('css', '.views-ui-view-name h3')->getText();
// Open the dropdown with additional actions.
$enabled_view->find('css', 'li.dropbutton-toggle button')->click();
$disable_button = $enabled_view->find('css', 'li.disable.dropbutton-action a');
@@ -109,6 +110,18 @@ class ViewsListingTest extends JavascriptTestBase {
// Test that one enabled View has been moved to the disabled list.
$this->assertCount($enabled_views_count - 1, $enabled_rows);
$this->assertCount($disabled_views_count + 1, $disabled_rows);
// Test that the keyboard focus is on the dropdown button of the View we
// just disabled.
$this->assertTrue($this->getSession()->evaluateScript("jQuery(document.activeElement).parent().is('li.enable.dropbutton-action')"));
$this->assertEquals($view_description, $this->getSession()->evaluateScript("jQuery(document.activeElement).parents('tr').find('h3').text()"));
// Enable the view again and ensure we have the focus on the edit button.
$this->getSession()->evaluateScript('jQuery(document.activeElement).click()');
$session->assertWaitOnAjaxRequest();
$this->assertTrue($this->getSession()->evaluateScript("jQuery(document.activeElement).parent().is('li.edit.dropbutton-action')"));
$this->assertEquals($view_description, $this->getSession()->evaluateScript("jQuery(document.activeElement).parents('tr').find('h3').text()"));
}
/**
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests views creation wizard.
@@ -10,7 +10,7 @@ use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
* @see core/modules/views_ui/js/views-admin.js
* @group views_ui
*/
class ViewsWizardTest extends JavascriptTestBase {
class ViewsWizardTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@@ -48,7 +48,7 @@ class ViewListBuilderTest extends UnitTestCase {
'theme' => 'views_view',
'no_ui' => TRUE,
'admin' => '',
]
],
],
[
'page',
@@ -61,7 +61,7 @@ class ViewListBuilderTest extends UnitTestCase {
'contextual_links_locations' => ['page'],
'theme' => 'views_view',
'admin' => 'Page admin label',
]
],
],
[
'embed',
@@ -71,7 +71,7 @@ class ViewListBuilderTest extends UnitTestCase {
'title' => 'embed',
'theme' => 'views_view',
'admin' => 'Embed admin label',
]
],
],
]));
+1 -1
View File
@@ -6,4 +6,4 @@ version: VERSION
core: 8.x
configure: entity.view.collection
dependencies:
- views
- drupal:views
+3 -4
View File
@@ -5,7 +5,6 @@
* Provide structure for the administrative interface to Views.
*/
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\views\ViewExecutable;
@@ -135,7 +134,7 @@ function views_ui_preprocess_views_view(&$variables) {
// Render title for the admin preview.
if (!empty($view->live_preview)) {
$variables['title'] = [
'#markup' => $view->getTitle()
'#markup' => $view->getTitle(),
];
}
@@ -341,8 +340,8 @@ function views_ui_views_analyze(ViewExecutable $view) {
* This is often used in the UI to ensure long strings fit.
*/
function views_ui_truncate($string, $length) {
if (Unicode::strlen($string) > $length) {
$string = Unicode::substr($string, 0, $length);
if (mb_strlen($string) > $length) {
$string = mb_substr($string, 0, $length);
$string .= '...';
}
+5 -5
View File
@@ -5,7 +5,7 @@
* Preprocessors and theme functions for the Views UI.
*/
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormState;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\Checkboxes;
@@ -158,7 +158,7 @@ function template_preprocess_views_ui_build_group_filter_form(&$variables) {
'title' => t('Remove this item'),
],
]),
'#title' => SafeMarkup::format('<span>@text</span>', ['@text' => t('Remove')]),
'#title' => new FormattableMarkup('<span>@text</span>', ['@text' => t('Remove')]),
];
$remove = [$form['group_items'][$group_id]['remove'], $link];
$data = [
@@ -184,7 +184,7 @@ function template_preprocess_views_ui_build_group_filter_form(&$variables) {
'action' => 'order',
'relationship' => 'sibling',
'group' => 'weight',
]
],
],
];
@@ -286,7 +286,7 @@ function template_preprocess_views_ui_rearrange_filter_form(&$variables) {
$remove_link = [
'#type' => 'link',
'#url' => Url::fromRoute('<none>'),
'#title' => SafeMarkup::format('<span>@text</span>', ['@text' => t('Remove')]),
'#title' => new FormattableMarkup('<span>@text</span>', ['@text' => t('Remove')]),
'#weight' => '1',
'#options' => [
'attributes' => [
@@ -353,7 +353,7 @@ function template_preprocess_views_ui_rearrange_filter_form(&$variables) {
'action' => 'order',
'relationship' => 'sibling',
'group' => 'weight',
]
],
],
];
}