updated core to 8.6.1 via composer
This commit is contained in:
@@ -77,4 +77,3 @@ views.area.http_status_code:
|
||||
status_code:
|
||||
type: integer
|
||||
label: 'HTTP status code'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Handles AJAX fetching of views, including filter submission and response.
|
||||
*/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
(function($, Drupal, drupalSettings) {
|
||||
/**
|
||||
* Attaches the AJAX behavior to exposed filters forms and key View links.
|
||||
*
|
||||
@@ -13,14 +13,32 @@
|
||||
* Attaches ajaxView functionality to relevant elements.
|
||||
*/
|
||||
Drupal.behaviors.ViewsAjaxView = {};
|
||||
Drupal.behaviors.ViewsAjaxView.attach = function () {
|
||||
if (drupalSettings && drupalSettings.views && drupalSettings.views.ajaxViews) {
|
||||
const ajaxViews = drupalSettings.views.ajaxViews;
|
||||
Object.keys(ajaxViews || {}).forEach((i) => {
|
||||
Drupal.behaviors.ViewsAjaxView.attach = function(context, settings) {
|
||||
if (settings && settings.views && settings.views.ajaxViews) {
|
||||
const {
|
||||
views: { ajaxViews },
|
||||
} = settings;
|
||||
Object.keys(ajaxViews || {}).forEach(i => {
|
||||
Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]);
|
||||
});
|
||||
}
|
||||
};
|
||||
Drupal.behaviors.ViewsAjaxView.detach = (context, settings, trigger) => {
|
||||
if (trigger === 'unload') {
|
||||
if (settings && settings.views && settings.views.ajaxViews) {
|
||||
const {
|
||||
views: { ajaxViews },
|
||||
} = settings;
|
||||
Object.keys(ajaxViews || {}).forEach(i => {
|
||||
const selector = `.js-view-dom-id-${ajaxViews[i].view_dom_id}`;
|
||||
if ($(selector, context).length) {
|
||||
delete Drupal.views.instances[i];
|
||||
delete settings.views.ajaxViews[i];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @namespace
|
||||
@@ -42,7 +60,7 @@
|
||||
* @param {string} settings.view_dom_id
|
||||
* The DOM id of the view.
|
||||
*/
|
||||
Drupal.views.ajaxView = function (settings) {
|
||||
Drupal.views.ajaxView = function(settings) {
|
||||
const selector = `.js-view-dom-id-${settings.view_dom_id}`;
|
||||
this.$view = $(selector);
|
||||
|
||||
@@ -59,11 +77,13 @@
|
||||
let queryString = window.location.search || '';
|
||||
if (queryString !== '') {
|
||||
// Remove the question mark and Drupal path component if any.
|
||||
queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, '');
|
||||
queryString = queryString
|
||||
.slice(1)
|
||||
.replace(/q=[^&]+&?|&?render=[^&]+/, '');
|
||||
if (queryString !== '') {
|
||||
// If there is a '?' in ajaxPath, clean url are on and & should be
|
||||
// used to add parameters.
|
||||
queryString = ((/\?/.test(ajaxPath)) ? '&' : '?') + queryString;
|
||||
queryString = (/\?/.test(ajaxPath) ? '&' : '?') + queryString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,15 +99,23 @@
|
||||
this.settings = settings;
|
||||
|
||||
// Add the ajax to exposed forms.
|
||||
this.$exposed_form = $(`form#views-exposed-form-${settings.view_name.replace(/_/g, '-')}-${settings.view_display_id.replace(/_/g, '-')}`);
|
||||
this.$exposed_form.once('exposed-form').each($.proxy(this.attachExposedFormAjax, this));
|
||||
this.$exposed_form = $(
|
||||
`form#views-exposed-form-${settings.view_name.replace(
|
||||
/_/g,
|
||||
'-',
|
||||
)}-${settings.view_display_id.replace(/_/g, '-')}`,
|
||||
);
|
||||
this.$exposed_form
|
||||
.once('exposed-form')
|
||||
.each($.proxy(this.attachExposedFormAjax, this));
|
||||
|
||||
// Add the ajax to pagers.
|
||||
this.$view
|
||||
// Don't attach to nested views. Doing so would attach multiple behaviors
|
||||
// to a given element.
|
||||
.filter($.proxy(this.filterNestedViews, this))
|
||||
.once('ajax-pager').each($.proxy(this.attachPagerAjax, this));
|
||||
.once('ajax-pager')
|
||||
.each($.proxy(this.attachPagerAjax, this));
|
||||
|
||||
// Add a trigger to update this view specifically. In order to trigger a
|
||||
// refresh use the following code.
|
||||
@@ -106,25 +134,27 @@
|
||||
/**
|
||||
* @method
|
||||
*/
|
||||
Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () {
|
||||
Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() {
|
||||
const that = this;
|
||||
this.exposedFormAjax = [];
|
||||
// Exclude the reset buttons so no AJAX behaviours are bound. Many things
|
||||
// break during the form reset phase if using AJAX.
|
||||
$('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) {
|
||||
const selfSettings = $.extend({}, that.element_settings, {
|
||||
base: $(this).attr('id'),
|
||||
element: this,
|
||||
$('input[type=submit], input[type=image]', this.$exposed_form)
|
||||
.not('[data-drupal-selector=edit-reset]')
|
||||
.each(function(index) {
|
||||
const selfSettings = $.extend({}, that.element_settings, {
|
||||
base: $(this).attr('id'),
|
||||
element: this,
|
||||
});
|
||||
that.exposedFormAjax[index] = Drupal.ajax(selfSettings);
|
||||
});
|
||||
that.exposedFormAjax[index] = Drupal.ajax(selfSettings);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {bool}
|
||||
* If there is at least one parent with a view class return false.
|
||||
*/
|
||||
Drupal.views.ajaxView.prototype.filterNestedViews = function () {
|
||||
Drupal.views.ajaxView.prototype.filterNestedViews = function() {
|
||||
// If there is at least one parent with a view class, this view
|
||||
// is nested (e.g., an attachment). Bail.
|
||||
return !this.$view.parents('.view').length;
|
||||
@@ -133,8 +163,11 @@
|
||||
/**
|
||||
* Attach the ajax behavior to each link.
|
||||
*/
|
||||
Drupal.views.ajaxView.prototype.attachPagerAjax = function () {
|
||||
this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a')
|
||||
Drupal.views.ajaxView.prototype.attachPagerAjax = function() {
|
||||
this.$view
|
||||
.find(
|
||||
'ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a',
|
||||
)
|
||||
.each($.proxy(this.attachPagerLinkAjax, this));
|
||||
};
|
||||
|
||||
@@ -146,7 +179,7 @@
|
||||
* @param {HTMLElement} link
|
||||
* The link element.
|
||||
*/
|
||||
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) {
|
||||
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) {
|
||||
const $link = $(link);
|
||||
const viewData = {};
|
||||
const href = $link.attr('href');
|
||||
@@ -178,7 +211,7 @@
|
||||
* @param {string} response.selector
|
||||
* Selector to use.
|
||||
*/
|
||||
Drupal.AjaxCommands.prototype.viewsScrollTop = function (ajax, response) {
|
||||
Drupal.AjaxCommands.prototype.viewsScrollTop = function(ajax, response) {
|
||||
// Scroll to the top of the view. This will allow users
|
||||
// to browse newly loaded content after e.g. clicking a pager
|
||||
// link.
|
||||
@@ -193,7 +226,7 @@
|
||||
}
|
||||
// Only scroll upward.
|
||||
if (offset.top - 10 < $(scrollTarget).scrollTop()) {
|
||||
$(scrollTarget).animate({ scrollTop: (offset.top - 10) }, 500);
|
||||
$(scrollTarget).animate({ scrollTop: offset.top - 10 }, 500);
|
||||
}
|
||||
};
|
||||
}(jQuery, Drupal, drupalSettings));
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
|
||||
@@ -7,14 +7,30 @@
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
Drupal.behaviors.ViewsAjaxView = {};
|
||||
Drupal.behaviors.ViewsAjaxView.attach = function () {
|
||||
if (drupalSettings && drupalSettings.views && drupalSettings.views.ajaxViews) {
|
||||
var ajaxViews = drupalSettings.views.ajaxViews;
|
||||
Drupal.behaviors.ViewsAjaxView.attach = function (context, settings) {
|
||||
if (settings && settings.views && settings.views.ajaxViews) {
|
||||
var ajaxViews = settings.views.ajaxViews;
|
||||
|
||||
Object.keys(ajaxViews || {}).forEach(function (i) {
|
||||
Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]);
|
||||
});
|
||||
}
|
||||
};
|
||||
Drupal.behaviors.ViewsAjaxView.detach = function (context, settings, trigger) {
|
||||
if (trigger === 'unload') {
|
||||
if (settings && settings.views && settings.views.ajaxViews) {
|
||||
var ajaxViews = settings.views.ajaxViews;
|
||||
|
||||
Object.keys(ajaxViews || {}).forEach(function (i) {
|
||||
var selector = '.js-view-dom-id-' + ajaxViews[i].view_dom_id;
|
||||
if ($(selector, context).length) {
|
||||
delete Drupal.views.instances[i];
|
||||
delete settings.views.ajaxViews[i];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.views = {};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Some basic behaviors and utility functions for Views.
|
||||
*/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
(function($, Drupal, drupalSettings) {
|
||||
/**
|
||||
* @namespace
|
||||
*/
|
||||
@@ -18,7 +18,7 @@
|
||||
* @return {object}
|
||||
* A map of query parameters.
|
||||
*/
|
||||
Drupal.Views.parseQueryString = function (query) {
|
||||
Drupal.Views.parseQueryString = function(query) {
|
||||
const args = {};
|
||||
const pos = query.indexOf('?');
|
||||
if (pos !== -1) {
|
||||
@@ -30,7 +30,9 @@
|
||||
pair = pairs[i].split('=');
|
||||
// Ignore the 'q' path argument, if present.
|
||||
if (pair[0] !== 'q' && pair[1]) {
|
||||
args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
|
||||
args[
|
||||
decodeURIComponent(pair[0].replace(/\+/g, ' '))
|
||||
] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
|
||||
}
|
||||
}
|
||||
return args;
|
||||
@@ -47,14 +49,18 @@
|
||||
* @return {object}
|
||||
* An object containing `view_args` and `view_path`.
|
||||
*/
|
||||
Drupal.Views.parseViewArgs = function (href, viewPath) {
|
||||
Drupal.Views.parseViewArgs = function(href, viewPath) {
|
||||
const returnObj = {};
|
||||
const path = Drupal.Views.getPath(href);
|
||||
// Get viewPath url without baseUrl portion.
|
||||
const viewHref = Drupal.url(viewPath).substring(drupalSettings.path.baseUrl.length);
|
||||
const viewHref = Drupal.url(viewPath).substring(
|
||||
drupalSettings.path.baseUrl.length,
|
||||
);
|
||||
// Ensure we have a correct path.
|
||||
if (viewHref && path.substring(0, viewHref.length + 1) === `${viewHref}/`) {
|
||||
returnObj.view_args = decodeURIComponent(path.substring(viewHref.length + 1, path.length));
|
||||
returnObj.view_args = decodeURIComponent(
|
||||
path.substring(viewHref.length + 1, path.length),
|
||||
);
|
||||
returnObj.view_path = path;
|
||||
}
|
||||
return returnObj;
|
||||
@@ -69,7 +75,7 @@
|
||||
* @return {string}
|
||||
* The href without the protocol and domain.
|
||||
*/
|
||||
Drupal.Views.pathPortion = function (href) {
|
||||
Drupal.Views.pathPortion = function(href) {
|
||||
// Remove e.g. http://example.com if present.
|
||||
const protocol = window.location.protocol;
|
||||
if (href.substring(0, protocol.length) === protocol) {
|
||||
@@ -88,7 +94,7 @@
|
||||
* @return {string}
|
||||
* An internal path.
|
||||
*/
|
||||
Drupal.Views.getPath = function (href) {
|
||||
Drupal.Views.getPath = function(href) {
|
||||
href = Drupal.Views.pathPortion(href);
|
||||
href = href.substring(drupalSettings.path.baseUrl.length, href.length);
|
||||
// 3 is the length of the '?q=' added to the url without clean urls.
|
||||
@@ -103,4 +109,4 @@
|
||||
}
|
||||
return href;
|
||||
};
|
||||
}(jQuery, Drupal, drupalSettings));
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
|
||||
@@ -31,7 +31,6 @@ class Analyzer {
|
||||
$this->moduleHandler = $module_handler;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Analyzes a review and return the results.
|
||||
*
|
||||
@@ -52,7 +51,8 @@ class Analyzer {
|
||||
/**
|
||||
* Formats the analyze result into a message string.
|
||||
*
|
||||
* This is based upon the format of drupal_set_message which uses separate
|
||||
* This is based upon the format of
|
||||
* \Drupal\Core\Messenger\MessengerInterface::addMessage() which uses separate
|
||||
* boxes for "ok", "warning" and "error".
|
||||
*/
|
||||
public function formatMessages(array $messages) {
|
||||
|
||||
@@ -132,7 +132,20 @@ class ViewAjaxController implements ContainerInjectionInterface {
|
||||
|
||||
// Remove all of this stuff from the query of the request so it doesn't
|
||||
// end up in pagers and tablesort URLs.
|
||||
foreach (['view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', AjaxResponseSubscriber::AJAX_REQUEST_PARAMETER] as $key) {
|
||||
// @todo Remove this parsing once these are removed from the request in
|
||||
// https://www.drupal.org/node/2504709.
|
||||
foreach ([
|
||||
'view_name',
|
||||
'view_display_id',
|
||||
'view_args',
|
||||
'view_path',
|
||||
'view_dom_id',
|
||||
'pager_element',
|
||||
'view_base_path',
|
||||
AjaxResponseSubscriber::AJAX_REQUEST_PARAMETER,
|
||||
FormBuilderInterface::AJAX_FORM_REQUEST,
|
||||
MainContentViewSubscriber::WRAPPER_FORMAT,
|
||||
] as $key) {
|
||||
$request->query->remove($key);
|
||||
$request->request->remove($key);
|
||||
}
|
||||
@@ -152,6 +165,7 @@ class ViewAjaxController implements ContainerInjectionInterface {
|
||||
// Add all POST data, because AJAX is always a post and many things,
|
||||
// such as tablesorts, exposed filters and paging assume GET.
|
||||
$request_all = $request->request->all();
|
||||
unset($request_all['ajax_page_state']);
|
||||
$query_all = $request->query->all();
|
||||
$request->query->replace($request_all + $query_all);
|
||||
|
||||
@@ -159,13 +173,7 @@ class ViewAjaxController implements ContainerInjectionInterface {
|
||||
// @see the redirect.destination service.
|
||||
$origin_destination = $path;
|
||||
|
||||
// Remove some special parameters you never want to have part of the
|
||||
// destination query.
|
||||
$used_query_parameters = $request->query->all();
|
||||
// @todo Remove this parsing once these are removed from the request in
|
||||
// https://www.drupal.org/node/2504709.
|
||||
unset($used_query_parameters[FormBuilderInterface::AJAX_FORM_REQUEST], $used_query_parameters[MainContentViewSubscriber::WRAPPER_FORMAT], $used_query_parameters['ajax_page_state']);
|
||||
|
||||
$query = UrlHelper::buildQuery($used_query_parameters);
|
||||
if ($query != '') {
|
||||
$origin_destination .= '?' . $query;
|
||||
|
||||
@@ -80,7 +80,7 @@ class DisplayPluginCollection extends DefaultLazyPluginCollection {
|
||||
// display plugin isn't found.
|
||||
catch (PluginException $e) {
|
||||
$message = $e->getMessage();
|
||||
drupal_set_message(t('@message', ['@message' => $message]), 'warning');
|
||||
\Drupal::messenger()->addWarning(t('@message', ['@message' => $message]));
|
||||
}
|
||||
|
||||
// If no plugin instance has been created, return NULL.
|
||||
|
||||
@@ -19,6 +19,14 @@ use Drupal\views\ViewEntityInterface;
|
||||
* @ConfigEntityType(
|
||||
* id = "view",
|
||||
* label = @Translation("View", context = "View entity type"),
|
||||
* label_collection = @Translation("Views", context = "View entity type"),
|
||||
* label_singular = @Translation("view", context = "View entity type"),
|
||||
* label_plural = @Translation("views", context = "View entity type"),
|
||||
* label_count = @PluralTranslation(
|
||||
* singular = "@count view",
|
||||
* plural = "@count views",
|
||||
* context = "View entity type",
|
||||
* ),
|
||||
* admin_permission = "administer views",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
@@ -317,6 +325,8 @@ class View extends ConfigEntityBase implements ViewEntityInterface {
|
||||
* An array containing display handlers of a view.
|
||||
*
|
||||
* @deprecated in Drupal 8.3.0, will be removed in Drupal 9.0.0.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2831499
|
||||
*/
|
||||
private function fixTableNames(array &$displays) {
|
||||
// Fix wrong table names for entity revision metadata fields.
|
||||
@@ -421,7 +431,7 @@ class View extends ConfigEntityBase implements ViewEntityInterface {
|
||||
'position' => 0,
|
||||
'display_options' => [],
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
|
||||
$data[$base_table]['table']['join'][$data_table] = [
|
||||
'left_field' => $base_field,
|
||||
'field' => $base_field,
|
||||
'type' => 'INNER'
|
||||
'type' => 'INNER',
|
||||
];
|
||||
$data[$data_table]['table']['group'] = $this->entityType->getLabel();
|
||||
$data[$data_table]['table']['provider'] = $this->entityType->getProvider();
|
||||
@@ -253,6 +253,9 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
|
||||
}
|
||||
|
||||
$this->addEntityLinks($data[$base_table]);
|
||||
if ($views_revision_base_table) {
|
||||
$this->addEntityLinks($data[$views_revision_base_table]);
|
||||
}
|
||||
|
||||
// Load all typed data definitions of all fields. This should cover each of
|
||||
// the entity base, revision, data tables.
|
||||
|
||||
@@ -103,7 +103,7 @@ class ViewsExposedForm extends FormBase {
|
||||
}
|
||||
|
||||
$form['actions'] = [
|
||||
'#type' => 'actions'
|
||||
'#type' => 'actions',
|
||||
];
|
||||
$form['actions']['submit'] = [
|
||||
// Prevent from showing up in \Drupal::request()->query.
|
||||
@@ -183,7 +183,7 @@ class ViewsExposedForm extends FormBase {
|
||||
// https://www.drupal.org/node/342316 is resolved.
|
||||
$checked = Checkboxes::getCheckedCheckboxes($value);
|
||||
foreach ($checked as $option_id) {
|
||||
$view->exposed_raw_input[$option_id] = $value[$option_id];
|
||||
$view->exposed_raw_input[$key][] = $value[$option_id];
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Views;
|
||||
* The derivatives store all base table plugin information.
|
||||
*/
|
||||
class DefaultWizardDeriver extends DeriverBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -25,7 +26,7 @@ class DefaultWizardDeriver extends DeriverBase {
|
||||
'id' => 'standard',
|
||||
'base_table' => $table,
|
||||
'title' => $views_info['table']['base']['title'],
|
||||
'class' => 'Drupal\views\Plugin\views\wizard\Standard'
|
||||
'class' => 'Drupal\views\Plugin\views\wizard\Standard',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ class ViewsExposedFilterBlock implements ContainerDeriverInterface {
|
||||
'config_dependencies' => [
|
||||
'config' => [
|
||||
$view->getConfigDependencyName(),
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
$this->derivatives[$delta] += $base_plugin_definition;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class ViewsSelection extends SelectionPluginBase implements ContainerFactoryPlug
|
||||
/**
|
||||
* The loaded View object.
|
||||
*
|
||||
* @var \Drupal\views\ViewExecutable;
|
||||
* @var \Drupal\views\ViewExecutable
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
@@ -132,7 +132,7 @@ class ViewsSelection extends SelectionPluginBase implements ContainerFactoryPlug
|
||||
// Check that the view is valid and the display still exists.
|
||||
$this->view = Views::getView($view_name);
|
||||
if (!$this->view || !$this->view->access($display_name)) {
|
||||
drupal_set_message(t('The reference view %view_name cannot be found.', ['%view_name' => $view_name]), 'warning');
|
||||
\Drupal::messenger()->addWarning(t('The reference view %view_name cannot be found.', ['%view_name' => $view_name]));
|
||||
return FALSE;
|
||||
}
|
||||
$this->view->setDisplay($display_name);
|
||||
|
||||
@@ -126,7 +126,6 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf
|
||||
return (bool) $this->loadView()->display_handler->getOption('menu')['expanded'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\views\Plugin\views;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ trait BrokenHandlerTrait {
|
||||
|
||||
foreach ($this->definition['original_configuration'] as $key => $value) {
|
||||
if (is_scalar($value)) {
|
||||
$items[] = SafeMarkup::format('@key: @value', ['@key' => $key, '@value' => $value]);
|
||||
$items[] = new FormattableMarkup('@key: @value', ['@key' => $key, '@value' => $value]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,9 +230,9 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface {
|
||||
default:
|
||||
return $string;
|
||||
case 'upper':
|
||||
return Unicode::strtoupper($string);
|
||||
return mb_strtoupper($string);
|
||||
case 'lower':
|
||||
return Unicode::strtolower($string);
|
||||
return mb_strtolower($string);
|
||||
case 'ucfirst':
|
||||
return Unicode::ucfirst($string);
|
||||
case 'ucwords':
|
||||
@@ -313,6 +313,7 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface {
|
||||
public function usesGroupBy() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a form for aggregation settings.
|
||||
*/
|
||||
|
||||
@@ -400,7 +400,7 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
|
||||
'#post_render' => [
|
||||
function ($children, $elements) {
|
||||
return Xss::filterAdmin($children);
|
||||
}
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -115,11 +115,13 @@ class Result extends AreaPluginBase {
|
||||
// Send the output.
|
||||
if (!empty($total) || !empty($this->options['empty'])) {
|
||||
$output .= Xss::filterAdmin(str_replace(array_keys($replacements), array_values($replacements), $format));
|
||||
// Return as render array.
|
||||
return [
|
||||
'#markup' => $output,
|
||||
];
|
||||
}
|
||||
// Return as render array.
|
||||
return [
|
||||
'#markup' => $output,
|
||||
];
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class View extends AreaPluginBase {
|
||||
// Check if the view is part of the parent views of this view
|
||||
$search = "$view_name:$display_id";
|
||||
if (in_array($search, $this->view->parent_views)) {
|
||||
drupal_set_message(t("Recursion detected in view @view display @display.", ['@view' => $view_name, '@display' => $display_id]), 'error');
|
||||
\Drupal::messenger()->addError(t("Recursion detected in view @view display @display.", ['@view' => $view_name, '@display' => $display_id]));
|
||||
}
|
||||
else {
|
||||
if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
|
||||
|
||||
@@ -398,7 +398,6 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
|
||||
$option_values = &$form_state->getValue('options');
|
||||
if (empty($option_values)) {
|
||||
@@ -550,7 +549,7 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Skip default argument for view URL'),
|
||||
'#default_value' => $this->options['default_argument_skip_url'],
|
||||
'#description' => $this->t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.')
|
||||
'#description' => $this->t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.'),
|
||||
];
|
||||
|
||||
$form['default_argument_type'] = [
|
||||
@@ -640,7 +639,7 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
|
||||
'#default_value' => $this->options['summary']['number_of_records'],
|
||||
'#options' => [
|
||||
0 => $this->getSortName(),
|
||||
1 => $this->t('Number of records')
|
||||
1 => $this->t('Number of records'),
|
||||
],
|
||||
'#states' => [
|
||||
'visible' => [
|
||||
@@ -721,6 +720,7 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
|
||||
$info = $this->defaultActions($this->options['validate']['fail']);
|
||||
return $this->defaultAction($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default action: ignore.
|
||||
*
|
||||
|
||||
@@ -105,16 +105,16 @@ class NumericArgument extends ArgumentPluginBase {
|
||||
}
|
||||
|
||||
$placeholder = $this->placeholder();
|
||||
$null_check = empty($this->options['not']) ? '' : "OR $this->tableAlias.$this->realField IS NULL";
|
||||
$null_check = empty($this->options['not']) ? '' : " OR $this->tableAlias.$this->realField IS NULL";
|
||||
|
||||
if (count($this->value) > 1) {
|
||||
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
|
||||
$placeholder .= '[]';
|
||||
$this->query->addWhereExpression(0, "$this->tableAlias.$this->realField $operator($placeholder) $null_check", [$placeholder => $this->value]);
|
||||
$this->query->addWhereExpression(0, "$this->tableAlias.$this->realField $operator($placeholder)" . $null_check, [$placeholder => $this->value]);
|
||||
}
|
||||
else {
|
||||
$operator = empty($this->options['not']) ? '=' : '!=';
|
||||
$this->query->addWhereExpression(0, "$this->tableAlias.$this->realField $operator $placeholder $null_check", [$placeholder => $this->argument]);
|
||||
$this->query->addWhereExpression(0, "$this->tableAlias.$this->realField $operator $placeholder" . $null_check, [$placeholder => $this->argument]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\views\Plugin\views\argument;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\Context\ContextDefinition;
|
||||
@@ -214,7 +213,7 @@ class StringArgument extends ArgumentPluginBase {
|
||||
// converting the arguments to lowercase.
|
||||
if ($this->options['case'] != 'none' && Database::getConnection()->databaseType() == 'pgsql') {
|
||||
foreach ($this->value as $key => $value) {
|
||||
$this->value[$key] = Unicode::strtolower($value);
|
||||
$this->value[$key] = mb_strtolower($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Drupal\views\Plugin\views\argument_validator;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\Context\ContextDefinition;
|
||||
use Drupal\Core\Plugin\Context\EntityContextDefinition;
|
||||
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
@@ -233,7 +233,9 @@ class Entity extends ArgumentValidatorPluginBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContextDefinition() {
|
||||
return new ContextDefinition('entity:' . $this->definition['entity_type'], $this->argument->adminLabel(), FALSE);
|
||||
return EntityContextDefinition::fromEntityTypeId($this->definition['entity_type'])
|
||||
->setLabel($this->argument->adminLabel())
|
||||
->setRequired(FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -97,6 +97,9 @@ abstract class CachePluginBase extends PluginBase {
|
||||
* Save data to the cache.
|
||||
*
|
||||
* A plugin should override this to provide specialized caching behavior.
|
||||
*
|
||||
* @param $type
|
||||
* The cache type, either 'query', 'result'.
|
||||
*/
|
||||
public function cacheSet($type) {
|
||||
switch ($type) {
|
||||
@@ -119,6 +122,12 @@ abstract class CachePluginBase extends PluginBase {
|
||||
* Retrieve data from the cache.
|
||||
*
|
||||
* A plugin should override this to provide specialized caching behavior.
|
||||
*
|
||||
* @param $type
|
||||
* The cache type, either 'query', 'result'.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if data has been taken from the cache, otherwise FALSE.
|
||||
*/
|
||||
public function cacheGet($type) {
|
||||
$cutoff = $this->cacheExpire($type);
|
||||
@@ -154,19 +163,22 @@ abstract class CachePluginBase extends PluginBase {
|
||||
/**
|
||||
* Post process any rendered data.
|
||||
*
|
||||
* This can be valuable to be able to cache a view and still have some level of
|
||||
* dynamic output. In an ideal world, the actual output will include HTML
|
||||
* This can be valuable to be able to cache a view and still have some level
|
||||
* of dynamic output. In an ideal world, the actual output will include HTML
|
||||
* comment based tokens, and then the post process can replace those tokens.
|
||||
*
|
||||
* Example usage. If it is known that the view is a node view and that the
|
||||
* primary field will be a nid, you can do something like this:
|
||||
*
|
||||
* <!--post-FIELD-NID-->
|
||||
* @code
|
||||
* <!--post-FIELD-NID-->
|
||||
* @endcode
|
||||
*
|
||||
* And then in the post render, create an array with the text that should
|
||||
* go there:
|
||||
*
|
||||
* strtr($output, array('<!--post-FIELD-1-->', 'output for FIELD of nid 1');
|
||||
* @code
|
||||
* strtr($output, array('<!--post-FIELD-1-->', 'output for FIELD of nid 1');
|
||||
* @endcode
|
||||
*
|
||||
* All of the cached result data will be available in $view->result, as well,
|
||||
* so all ids used in the query should be discoverable.
|
||||
|
||||
@@ -19,7 +19,6 @@ class None extends CachePluginBase {
|
||||
return $this->t('None');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views\Plugin\views\cache\CachePluginBase::cacheGet().
|
||||
*
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Drupal\views\Plugin\views\display;
|
||||
|
||||
use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
|
||||
use Drupal\Core\Block\BlockManagerInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\views\Plugin\Block\ViewsBlock;
|
||||
@@ -42,6 +44,13 @@ class Block extends DisplayPluginBase {
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* The block manager.
|
||||
*
|
||||
* @var \Drupal\Core\Block\BlockManagerInterface
|
||||
*/
|
||||
protected $blockManager;
|
||||
|
||||
/**
|
||||
* Constructs a new Block instance.
|
||||
*
|
||||
@@ -53,11 +62,14 @@ class Block extends DisplayPluginBase {
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
* @param \Drupal\Core\Block\BlockManagerInterface $block_manager
|
||||
* The block manager.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, BlockManagerInterface $block_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->entityManager = $entity_manager;
|
||||
$this->blockManager = $block_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +80,8 @@ class Block extends DisplayPluginBase {
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('entity.manager')
|
||||
$container->get('entity.manager'),
|
||||
$container->get('plugin.manager.block')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -364,6 +377,9 @@ class Block extends DisplayPluginBase {
|
||||
$block->delete();
|
||||
}
|
||||
}
|
||||
if ($this->blockManager instanceof CachedDiscoveryInterface) {
|
||||
$this->blockManager->clearCachedDefinitions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Drupal\views\Plugin\views\display;
|
||||
|
||||
use Drupal\Component\Plugin\DependentPluginInterface;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
use Drupal\Core\Cache\CacheableDependencyInterface;
|
||||
@@ -962,7 +962,6 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -1022,7 +1021,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||
}
|
||||
|
||||
if (!empty($class)) {
|
||||
$text = SafeMarkup::format('<span>@text</span>', ['@text' => $text]);
|
||||
$text = new FormattableMarkup('<span>@text</span>', ['@text' => $text]);
|
||||
}
|
||||
|
||||
if (empty($title)) {
|
||||
@@ -1033,13 +1032,13 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||
'js' => 'nojs',
|
||||
'view' => $this->view->storage->id(),
|
||||
'display_id' => $this->display['id'],
|
||||
'type' => $section
|
||||
'type' => $section,
|
||||
], [
|
||||
'attributes' => [
|
||||
'class' => ['views-ajax-link', $class],
|
||||
'title' => $title,
|
||||
'id' => Html::getUniqueId('views-' . $this->display['id'] . '-' . $section)
|
||||
]
|
||||
'id' => Html::getUniqueId('views-' . $this->display['id'] . '-' . $section),
|
||||
],
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -2587,7 +2586,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||
public function getPagerText() {
|
||||
return [
|
||||
'items per page title' => $this->t('Items to display'),
|
||||
'items per page description' => $this->t('Enter 0 for no limit.')
|
||||
'items per page description' => $this->t('Enter 0 for no limit.'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -457,7 +457,6 @@ interface DisplayPluginInterface {
|
||||
*/
|
||||
public function execute();
|
||||
|
||||
|
||||
/**
|
||||
* Builds a basic render array which can be properly render cached.
|
||||
*
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace Drupal\views\Plugin\views\display;
|
||||
*/
|
||||
class Embed extends DisplayPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $usesAttachments = TRUE;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -54,9 +54,6 @@ class EntityReference extends DisplayPluginBase {
|
||||
$options['row']['contains']['type'] = ['default' => 'entity_reference'];
|
||||
$options['defaults']['default']['row'] = FALSE;
|
||||
|
||||
// Make sure the query is not cached.
|
||||
$options['defaults']['default']['cache'] = FALSE;
|
||||
|
||||
// Set the display title to an empty string (not used in this display type).
|
||||
$options['title']['default'] = '';
|
||||
$options['defaults']['default']['title'] = FALSE;
|
||||
@@ -65,13 +62,12 @@ class EntityReference extends DisplayPluginBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
|
||||
*
|
||||
* Disable 'cache' and 'title' so it won't be changed.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function optionsSummary(&$categories, &$options) {
|
||||
parent::optionsSummary($categories, $options);
|
||||
unset($options['query']);
|
||||
// Disable 'title' so it won't be changed from the default set in
|
||||
// \Drupal\views\Plugin\views\display\EntityReference::defineOptions.
|
||||
unset($options['title']);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,6 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -141,7 +140,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
|
||||
|
||||
// Overrides for standard stuff.
|
||||
$options['style']['contains']['type']['default'] = 'rss';
|
||||
$options['style']['contains']['options']['default'] = ['description' => ''];
|
||||
$options['style']['contains']['options']['default'] = ['description' => ''];
|
||||
$options['sitename_title']['default'] = FALSE;
|
||||
$options['row']['contains']['type']['default'] = 'rss_fields';
|
||||
$options['defaults']['default']['style'] = FALSE;
|
||||
|
||||
@@ -259,7 +259,7 @@ class Page extends PathPluginBase {
|
||||
'none' => $this->t('No menu entry'),
|
||||
'normal' => $this->t('Normal menu entry'),
|
||||
'tab' => $this->t('Menu tab'),
|
||||
'default tab' => $this->t('Default menu tab')
|
||||
'default tab' => $this->t('Default menu tab'),
|
||||
],
|
||||
'#default_value' => $menu['type'],
|
||||
];
|
||||
@@ -532,7 +532,7 @@ class Page extends PathPluginBase {
|
||||
public function getPagerText() {
|
||||
return [
|
||||
'items per page title' => $this->t('Items per page'),
|
||||
'items per page description' => $this->t('Enter 0 for no limit.')
|
||||
'items per page description' => $this->t('Enter 0 for no limit.'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\RevisionableInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\Core\Messenger\MessengerInterface;
|
||||
use Drupal\Core\Routing\RedirectDestinationTrait;
|
||||
use Drupal\Core\TypedData\TranslatableInterface;
|
||||
use Drupal\views\Entity\Render\EntityTranslationRenderTrait;
|
||||
@@ -56,6 +57,13 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
/**
|
||||
* The messenger.
|
||||
*
|
||||
* @var \Drupal\Core\Messenger\MessengerInterface
|
||||
*/
|
||||
protected $messenger;
|
||||
|
||||
/**
|
||||
* Constructs a new BulkForm object.
|
||||
*
|
||||
@@ -69,13 +77,18 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
||||
* The entity manager.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
|
||||
* The messenger.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, MessengerInterface $messenger) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->entityManager = $entity_manager;
|
||||
$this->actionStorage = $entity_manager->getStorage('action');
|
||||
$this->languageManager = $language_manager;
|
||||
$this->messenger = $messenger;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +100,8 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('entity.manager'),
|
||||
$container->get('language_manager')
|
||||
$container->get('language_manager'),
|
||||
$container->get('messenger')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -356,11 +370,11 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
||||
|
||||
// Skip execution if the user did not have access.
|
||||
if (!$action->getPlugin()->access($entity, $this->view->getUser())) {
|
||||
$this->drupalSetMessage($this->t('No access to execute %action on the @entity_type_label %entity_label.', [
|
||||
$this->messenger->addError($this->t('No access to execute %action on the @entity_type_label %entity_label.', [
|
||||
'%action' => $action->label(),
|
||||
'@entity_type_label' => $entity->getEntityType()->getLabel(),
|
||||
'%entity_label' => $entity->label()
|
||||
]), 'error');
|
||||
'%entity_label' => $entity->label(),
|
||||
]));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -382,7 +396,7 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
||||
// Don't display the message unless there are some elements affected and
|
||||
// there is no confirmation form.
|
||||
if ($count) {
|
||||
drupal_set_message($this->formatPlural($count, '%action was applied to @count item.', '%action was applied to @count items.', [
|
||||
$this->messenger->addStatus($this->formatPlural($count, '%action was applied to @count item.', '%action was applied to @count items.', [
|
||||
'%action' => $action->label(),
|
||||
]));
|
||||
}
|
||||
@@ -426,13 +440,6 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps drupal_set_message().
|
||||
*/
|
||||
protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = FALSE) {
|
||||
drupal_set_message($message, $type, $repeat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates a bulk form key.
|
||||
*
|
||||
|
||||
@@ -408,10 +408,10 @@ class EntityField extends FieldPluginBase implements CacheableDependencyInterfac
|
||||
];
|
||||
|
||||
$options['multi_type'] = [
|
||||
'default' => 'separator'
|
||||
'default' => 'separator',
|
||||
];
|
||||
$options['separator'] = [
|
||||
'default' => ', '
|
||||
'default' => ', ',
|
||||
];
|
||||
|
||||
$options['field_api_classes'] = [
|
||||
|
||||
@@ -158,6 +158,7 @@ class EntityOperations extends FieldPluginBase {
|
||||
protected function getLanguageManager() {
|
||||
return $this->languageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Drupal\views\Plugin\views\field;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Render\MarkupInterface;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
@@ -186,7 +185,13 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
|
||||
}
|
||||
|
||||
if (empty($table_alias)) {
|
||||
debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', ['@handler' => $this->definition['id'], '@identifier' => $identifier, '@table' => $info['table']]));
|
||||
trigger_error(sprintf(
|
||||
"Handler % tried to add additional_field %s but % could not be added!",
|
||||
$this->definition['id'],
|
||||
$identifier,
|
||||
$info['table']
|
||||
), E_USER_WARNING);
|
||||
|
||||
$this->aliases[$identifier] = 'broken';
|
||||
continue;
|
||||
}
|
||||
@@ -312,7 +317,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
|
||||
// @todo Add possible html5 elements.
|
||||
$elements = [
|
||||
'' => $this->t('- Use default -'),
|
||||
'0' => $this->t('- None -')
|
||||
'0' => $this->t('- None -'),
|
||||
];
|
||||
$elements += \Drupal::config('views.settings')->get('field_rewrite_elements');
|
||||
}
|
||||
@@ -1288,7 +1293,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
|
||||
$base_path = base_path();
|
||||
// Checks whether the path starts with the base_path.
|
||||
if (strpos($more_link_path, $base_path) === 0) {
|
||||
$more_link_path = Unicode::substr($more_link_path, Unicode::strlen($base_path));
|
||||
$more_link_path = mb_substr($more_link_path, mb_strlen($base_path));
|
||||
}
|
||||
|
||||
// @todo Views should expect and store a leading /. See
|
||||
@@ -1388,7 +1393,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
|
||||
];
|
||||
|
||||
$alter += [
|
||||
'path' => NULL
|
||||
'path' => NULL,
|
||||
];
|
||||
|
||||
$path = $alter['path'];
|
||||
@@ -1792,8 +1797,8 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
|
||||
* The trimmed string.
|
||||
*/
|
||||
public static function trimText($alter, $value) {
|
||||
if (Unicode::strlen($value) > $alter['max_length']) {
|
||||
$value = Unicode::substr($value, 0, $alter['max_length']);
|
||||
if (mb_strlen($value) > $alter['max_length']) {
|
||||
$value = mb_substr($value, 0, $alter['max_length']);
|
||||
if (!empty($alter['word_boundary'])) {
|
||||
$regex = "(.*)\b.+";
|
||||
if (function_exists('mb_ereg')) {
|
||||
|
||||
@@ -18,7 +18,9 @@ use Drupal\views\ResultRow;
|
||||
class MachineName extends FieldPluginBase {
|
||||
|
||||
/**
|
||||
* @var array Stores the available options.
|
||||
* Stores the available options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $valueOptions;
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ abstract class PrerenderList extends FieldPluginBase implements MultiItemsFieldH
|
||||
'#template' => '{{ items|safe_join(separator) }}',
|
||||
'#context' => [
|
||||
'items' => $items,
|
||||
'separator' => $this->sanitizeValue($this->options['separator'], 'xss_admin')
|
||||
]
|
||||
'separator' => $this->sanitizeValue($this->options['separator'], 'xss_admin'),
|
||||
],
|
||||
];
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -48,7 +48,6 @@ class BooleanOperator extends FilterPluginBase {
|
||||
// Whether to accept NULL as a false value or not
|
||||
public $accept_null = FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -656,7 +656,6 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate the build group options form.
|
||||
*/
|
||||
@@ -835,7 +834,6 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render our chunk of the exposed filter form when selecting
|
||||
*
|
||||
@@ -1105,7 +1103,7 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
|
||||
'#required' => TRUE,
|
||||
'#attributes' => [
|
||||
'class' => ['default-radios'],
|
||||
]
|
||||
],
|
||||
];
|
||||
// From all groups, let chose which is the default.
|
||||
$form['group_info']['default_group_multiple'] = [
|
||||
@@ -1114,7 +1112,7 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
|
||||
'#default_value' => $this->options['group_info']['default_group_multiple'],
|
||||
'#attributes' => [
|
||||
'class' => ['default-checkboxes'],
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
$form['group_info']['add_group'] = [
|
||||
@@ -1165,7 +1163,6 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
|
||||
$form_state->get('force_build_group_options', TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make some translations to a form item to make it more suitable to
|
||||
* exposing.
|
||||
@@ -1207,7 +1204,6 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sanitizes the HTML select element's options.
|
||||
*
|
||||
|
||||
@@ -20,6 +20,7 @@ class GroupByNumeric extends NumericFilter {
|
||||
$this->{$info[$this->operator]['method']}($field);
|
||||
}
|
||||
}
|
||||
|
||||
protected function opBetween($field) {
|
||||
$placeholder_min = $this->placeholder();
|
||||
$placeholder_max = $this->placeholder();
|
||||
|
||||
@@ -369,7 +369,7 @@ class InOperator extends FilterPluginBase {
|
||||
if ($values !== '') {
|
||||
$values .= ', ';
|
||||
}
|
||||
if (Unicode::strlen($values) > 8) {
|
||||
if (mb_strlen($values) > 8) {
|
||||
$values = Unicode::truncate($values, 8, FALSE, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ class ManyToOne extends InOperator {
|
||||
}
|
||||
|
||||
protected $valueFormType = 'select';
|
||||
|
||||
protected function valueForm(&$form, FormStateInterface $form_state) {
|
||||
parent::valueForm($form, $form_state);
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ class NumericFilter extends FilterPluginBase {
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a simple textfield for equality
|
||||
*/
|
||||
@@ -299,7 +300,7 @@ class NumericFilter extends FilterPluginBase {
|
||||
// Ensure there is something in the 'value'.
|
||||
$form['value'] = [
|
||||
'#type' => 'value',
|
||||
'#value' => NULL
|
||||
'#value' => NULL,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ class StringFilter extends FilterPluginBase {
|
||||
// Ensure there is something in the 'value'.
|
||||
$form['value'] = [
|
||||
'#type' => 'value',
|
||||
'#value' => NULL
|
||||
'#value' => NULL,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ class JoinPluginBase extends PluginBase implements JoinPluginInterface {
|
||||
// Merge in some default values.
|
||||
$configuration += [
|
||||
'type' => 'LEFT',
|
||||
'extra_operator' => 'AND'
|
||||
'extra_operator' => 'AND',
|
||||
];
|
||||
$this->configuration = $configuration;
|
||||
|
||||
@@ -281,6 +281,7 @@ class JoinPluginBase extends PluginBase implements JoinPluginInterface {
|
||||
|
||||
$select_query->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the extras to the join condition.
|
||||
*
|
||||
|
||||
@@ -233,7 +233,6 @@ abstract class SqlBase extends PagerPluginBase implements CacheableDependencyInt
|
||||
$this->view->query->setOffset($offset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the current page.
|
||||
*
|
||||
|
||||
@@ -8,6 +8,7 @@ use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Database\Query\Condition;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Messenger\MessengerInterface;
|
||||
use Drupal\views\Plugin\views\display\DisplayPluginBase;
|
||||
use Drupal\Core\Database\DatabaseExceptionWrapper;
|
||||
use Drupal\views\Plugin\views\join\JoinPluginBase;
|
||||
@@ -130,6 +131,13 @@ class Sql extends QueryPluginBase {
|
||||
*/
|
||||
protected $dateSql;
|
||||
|
||||
/**
|
||||
* The messenger.
|
||||
*
|
||||
* @var \Drupal\Core\Messenger\MessengerInterface
|
||||
*/
|
||||
protected $messenger;
|
||||
|
||||
/**
|
||||
* Constructs a Sql object.
|
||||
*
|
||||
@@ -143,21 +151,28 @@ class Sql extends QueryPluginBase {
|
||||
* The entity type manager.
|
||||
* @param \Drupal\views\Plugin\views\query\DateSqlInterface $date_sql
|
||||
* The database-specific date handler.
|
||||
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
|
||||
* The messenger.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, DateSqlInterface $date_sql) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, DateSqlInterface $date_sql, MessengerInterface $messenger) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->entityTypeManager = $entity_type_manager;
|
||||
$this->dateSql = $date_sql;
|
||||
$this->messenger = $messenger;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('entity_type.manager'),
|
||||
$container->get('views.date_sql')
|
||||
$container->get('views.date_sql'),
|
||||
$container->get('messenger')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -173,7 +188,7 @@ class Sql extends QueryPluginBase {
|
||||
'link' => NULL,
|
||||
'table' => $base_table,
|
||||
'alias' => $base_table,
|
||||
'base' => $base_table
|
||||
'base' => $base_table,
|
||||
];
|
||||
|
||||
// init the table queue with our primary table.
|
||||
@@ -1030,7 +1045,7 @@ class Sql extends QueryPluginBase {
|
||||
|
||||
$this->orderby[] = [
|
||||
'field' => $as,
|
||||
'direction' => strtoupper($order)
|
||||
'direction' => strtoupper($order),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1498,7 +1513,7 @@ class Sql extends QueryPluginBase {
|
||||
|
||||
if (!empty($this->limit) || !empty($this->offset)) {
|
||||
// We can't have an offset without a limit, so provide a very large limit instead.
|
||||
$limit = intval(!empty($this->limit) ? $this->limit : 999999);
|
||||
$limit = intval(!empty($this->limit) ? $this->limit : 999999);
|
||||
$offset = intval(!empty($this->offset) ? $this->offset : 0);
|
||||
$query->range($offset, $limit);
|
||||
}
|
||||
@@ -1522,7 +1537,7 @@ class Sql extends QueryPluginBase {
|
||||
catch (DatabaseExceptionWrapper $e) {
|
||||
$view->result = [];
|
||||
if (!empty($view->live_preview)) {
|
||||
drupal_set_message($e->getMessage(), 'error');
|
||||
$this->messenger->addError($e->getMessage());
|
||||
}
|
||||
else {
|
||||
throw new DatabaseExceptionWrapper("Exception in {$view->storage->label()}[{$view->storage->id()}]: {$e->getMessage()}");
|
||||
@@ -1778,7 +1793,7 @@ class Sql extends QueryPluginBase {
|
||||
'filter' => 'groupby_numeric',
|
||||
'sort' => 'groupby_numeric',
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class EntityReverse extends RelationshipPluginBase {
|
||||
'left_field' => $left_field,
|
||||
'table' => $this->definition['field table'],
|
||||
'field' => $this->definition['field field'],
|
||||
'adjusted' => TRUE
|
||||
'adjusted' => TRUE,
|
||||
];
|
||||
if (!empty($this->options['required'])) {
|
||||
$first['type'] = 'INNER';
|
||||
@@ -80,7 +80,7 @@ class EntityReverse extends RelationshipPluginBase {
|
||||
'left_field' => 'entity_id',
|
||||
'table' => $this->definition['base'],
|
||||
'field' => $this->definition['base field'],
|
||||
'adjusted' => TRUE
|
||||
'adjusted' => TRUE,
|
||||
];
|
||||
|
||||
if (!empty($this->options['required'])) {
|
||||
|
||||
@@ -56,8 +56,8 @@ class Opml extends StylePluginBase {
|
||||
*/
|
||||
public function render() {
|
||||
if (empty($this->view->rowPlugin)) {
|
||||
debug('Drupal\views\Plugin\views\style\Opml: Missing row plugin');
|
||||
return;
|
||||
trigger_error('Drupal\views\Plugin\views\style\Opml: Missing row plugin', E_WARNING);
|
||||
return [];
|
||||
}
|
||||
$rows = [];
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class Rss extends StylePluginBase {
|
||||
|
||||
public function render() {
|
||||
if (empty($this->view->rowPlugin)) {
|
||||
debug('Drupal\views\Plugin\views\style\Rss: Missing row plugin');
|
||||
trigger_error('Drupal\views\Plugin\views\style\Rss: Missing row plugin', E_WARNING);
|
||||
return [];
|
||||
}
|
||||
$rows = [];
|
||||
|
||||
@@ -457,8 +457,8 @@ abstract class StylePluginBase extends PluginBase {
|
||||
*/
|
||||
public function render() {
|
||||
if ($this->usesRowPlugin() && empty($this->view->rowPlugin)) {
|
||||
debug('Drupal\views\Plugin\views\style\StylePluginBase: Missing row plugin');
|
||||
return;
|
||||
trigger_error('Drupal\views\Plugin\views\style\StylePluginBase: Missing row plugin', E_WARNING);
|
||||
return [];
|
||||
}
|
||||
|
||||
// Group the rows according to the grouping instructions, if specified.
|
||||
|
||||
@@ -177,7 +177,7 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface {
|
||||
'plugin_id' => 'boolean',
|
||||
'entity_type' => $this->entityTypeId,
|
||||
'entity_field' => $field_name,
|
||||
]
|
||||
],
|
||||
] + $this->filters;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class FieldApiDataTest extends FieldTestBase {
|
||||
'field_name' => $field_names[0],
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'page',
|
||||
'label' => 'GiraffeA" label'
|
||||
'label' => 'GiraffeA" label',
|
||||
];
|
||||
FieldConfig::create($field)->save();
|
||||
|
||||
@@ -55,7 +55,7 @@ class FieldApiDataTest extends FieldTestBase {
|
||||
'field_name' => $field_names[0],
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'article',
|
||||
'label' => 'GiraffeB" label'
|
||||
'label' => 'GiraffeB" label',
|
||||
])->save();
|
||||
|
||||
// Now create some example nodes/users for the view result.
|
||||
@@ -230,7 +230,7 @@ class FieldApiDataTest extends FieldTestBase {
|
||||
'field_name' => $this->fieldStorages[0]->getName(),
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'news',
|
||||
'label' => 'GiraffeB" label'
|
||||
'label' => 'GiraffeB" label',
|
||||
])->save();
|
||||
$this->container->get('views.views_data')->clear();
|
||||
$data = $this->getViewsData();
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\views\Tests;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
|
||||
/**
|
||||
* Tests the ajax view functionality.
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class ViewAjaxTest extends ViewTestBase {
|
||||
|
||||
/**
|
||||
* Views used by this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = ['test_ajax_view', 'test_view'];
|
||||
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
$this->enableViewsTestModule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests an ajax view.
|
||||
*/
|
||||
public function testAjaxView() {
|
||||
$this->drupalGet('test_ajax_view');
|
||||
|
||||
$drupal_settings = $this->getDrupalSettings();
|
||||
$this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.');
|
||||
$this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1);
|
||||
$view_entry = array_keys($drupal_settings['views']['ajaxViews'])[0];
|
||||
$this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.');
|
||||
$this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.');
|
||||
|
||||
$data = [];
|
||||
$data['view_name'] = 'test_ajax_view';
|
||||
$data['view_display_id'] = 'test_ajax_view';
|
||||
|
||||
$post = [
|
||||
'view_name' => 'test_ajax_view',
|
||||
'view_display_id' => 'page_1',
|
||||
];
|
||||
$post += $this->getAjaxPageStatePostData();
|
||||
$response = $this->drupalPost('views/ajax', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
|
||||
$data = Json::decode($response);
|
||||
|
||||
$this->assertTrue(isset($data[0]['settings']['views']['ajaxViews']));
|
||||
|
||||
// Ensure that the view insert command is part of the result.
|
||||
$this->assertEqual($data[1]['command'], 'insert');
|
||||
$this->assertTrue(strpos($data[1]['selector'], '.js-view-dom-id-') === 0);
|
||||
|
||||
$this->setRawContent($data[1]['data']);
|
||||
$result = $this->xpath('//div[contains(@class, "views-row")]');
|
||||
$this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that non-ajax view cannot be accessed via an ajax HTTP request.
|
||||
*/
|
||||
public function testNonAjaxViewViaAjax() {
|
||||
$this->drupalPost('views/ajax', '', ['view_name' => 'test_ajax_view', 'view_display_id' => 'default'], ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
|
||||
$this->assertResponse(200);
|
||||
$this->drupalPost('views/ajax', '', ['view_name' => 'test_view', 'view_display_id' => 'default'], ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
|
||||
$this->assertResponse(403);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class ViewTestData {
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
'name' => ['name']
|
||||
'name' => ['name'],
|
||||
],
|
||||
'indexes' => [
|
||||
'ages' => ['age'],
|
||||
|
||||
@@ -1096,7 +1096,8 @@ class ViewExecutable {
|
||||
$argument->is_default = TRUE;
|
||||
}
|
||||
|
||||
// Set the argument, which will also validate that the argument can be set.
|
||||
// Set the argument, which ensures that the argument is valid and
|
||||
// possibly transforms the value.
|
||||
if (!$argument->setArgument($arg)) {
|
||||
$status = $argument->validateFail($arg);
|
||||
break;
|
||||
@@ -1110,9 +1111,11 @@ class ViewExecutable {
|
||||
$argument->query($this->display_handler->useGroupBy());
|
||||
}
|
||||
|
||||
// Add this argument's substitution
|
||||
// Add this argument's substitution.
|
||||
$substitutions["{{ arguments.$id }}"] = $arg_title;
|
||||
$substitutions["{{ raw_arguments.$id }}"] = strip_tags(Html::decodeEntities($arg));
|
||||
// Since argument validator plugins can potentially transform the value,
|
||||
// use whatever value the argument handler now has, not the raw value.
|
||||
$substitutions["{{ raw_arguments.$id }}"] = strip_tags(Html::decodeEntities($argument->getValue()));
|
||||
|
||||
// Test to see if we should use this argument's title
|
||||
if (!empty($argument->options['title_enable']) && !empty($argument->options['title'])) {
|
||||
|
||||
@@ -133,10 +133,8 @@ class ViewsData {
|
||||
*
|
||||
* @param string|null $key
|
||||
* The key of the cache entry to retrieve. Defaults to NULL, this will
|
||||
* return all table data.
|
||||
*
|
||||
* @deprecated NULL $key deprecated in Drupal 8.2.x and will be removed in
|
||||
* 9.0.0. Use getAll() instead.
|
||||
* return all table data. NULL $key deprecated in Drupal 8.2.x and will be
|
||||
* removed in 9.0.0. Use getAll() instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2723553
|
||||
*
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace Drupal\views;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
|
||||
/**
|
||||
* Defines a helper class for stuff related to views data.
|
||||
@@ -120,7 +119,7 @@ class ViewsDataHelper {
|
||||
}
|
||||
else {
|
||||
if ($string != 'base') {
|
||||
$strings[$field][$key][$string] = SafeMarkup::format("Error: missing @component", ['@component' => $string]);
|
||||
$strings[$field][$key][$string] = new FormattableMarkup("Error: missing @component", ['@component' => $string]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,14 +173,14 @@ class ViewsDataHelper {
|
||||
* decided.
|
||||
*/
|
||||
protected static function fetchedFieldSort($a, $b) {
|
||||
$a_group = Unicode::strtolower($a['group']);
|
||||
$b_group = Unicode::strtolower($b['group']);
|
||||
$a_group = mb_strtolower($a['group']);
|
||||
$b_group = mb_strtolower($b['group']);
|
||||
if ($a_group != $b_group) {
|
||||
return $a_group < $b_group ? -1 : 1;
|
||||
}
|
||||
|
||||
$a_title = Unicode::strtolower($a['title']);
|
||||
$b_title = Unicode::strtolower($b['title']);
|
||||
$a_title = mb_strtolower($a['title']);
|
||||
$b_title = mb_strtolower($b['title']);
|
||||
if ($a_title != $b_title) {
|
||||
return $a_title < $b_title ? -1 : 1;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<div{{ row.attributes.addClass(row_classes, options.row_class_default ? 'row-' ~ loop.index) }}>
|
||||
{% for column in row.content %}
|
||||
<div{{ column.attributes.addClass(col_classes, options.col_class_default ? 'col-' ~ loop.index) }}>
|
||||
{{ column.content }}
|
||||
{{- column.content -}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -69,7 +69,7 @@
|
||||
<div{{ column.attributes.addClass(col_classes, options.col_class_default ? 'col-' ~ loop.index) }}>
|
||||
{% for row in column.content %}
|
||||
<div{{ row.attributes.addClass(row_classes, options.row_class_default ? 'row-' ~ loop.index) }}>
|
||||
{{ row.content }}
|
||||
{{- row.content -}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
<{{ list.type }}{{ list.attributes }}>
|
||||
|
||||
{% for row in rows %}
|
||||
<li{{ row.attributes }}>{{ row.content }}</li>
|
||||
<li{{ row.attributes }}>
|
||||
{{- row.content -}}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
</{{ list.type }}>
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
]
|
||||
%}
|
||||
<div{{ row.attributes.addClass(row_classes) }}>
|
||||
{{ row.content }}
|
||||
{{- row.content -}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
+1
-1
@@ -601,4 +601,4 @@ display:
|
||||
- 'user.node_grants:view'
|
||||
- user.permissions
|
||||
max-age: 0
|
||||
tags: { }
|
||||
tags: { }
|
||||
|
||||
@@ -5,5 +5,5 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- entity_test
|
||||
- drupal:views
|
||||
- drupal:entity_test
|
||||
|
||||
-1
@@ -222,4 +222,3 @@ display:
|
||||
- 'user.node_grants:view'
|
||||
- user.permissions
|
||||
tags: { }
|
||||
|
||||
|
||||
-1
@@ -278,4 +278,3 @@ display:
|
||||
plugin_id: standard
|
||||
arguments: { }
|
||||
display_extenders: { }
|
||||
|
||||
|
||||
-1
@@ -35,4 +35,3 @@ display:
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: test-menu-link
|
||||
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: test_preprocess
|
||||
label: ''
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: entity_test
|
||||
base_field: nid
|
||||
core: '8'
|
||||
display:
|
||||
default:
|
||||
display_options:
|
||||
access:
|
||||
type: none
|
||||
cache:
|
||||
type: tag
|
||||
exposed_form:
|
||||
type: basic
|
||||
sorts:
|
||||
id:
|
||||
table: entity_test
|
||||
id: id
|
||||
field: id
|
||||
plugin_id: standard
|
||||
entity_type: entity_test
|
||||
entity_field: id
|
||||
order: desc
|
||||
pager:
|
||||
type: full
|
||||
options:
|
||||
items_per_page: 5
|
||||
style:
|
||||
type: default
|
||||
row:
|
||||
type: 'entity:entity_test'
|
||||
css_class: 'entity-test__default'
|
||||
display_plugin: default
|
||||
display_title: Master
|
||||
id: default
|
||||
position: 0
|
||||
display_2:
|
||||
display_options:
|
||||
access:
|
||||
type: none
|
||||
cache:
|
||||
type: tag
|
||||
exposed_form:
|
||||
type: basic
|
||||
sorts:
|
||||
id:
|
||||
table: entity_test
|
||||
id: id
|
||||
field: id
|
||||
plugin_id: standard
|
||||
entity_type: entity_test
|
||||
entity_field: id
|
||||
order: desc
|
||||
pager:
|
||||
type: full
|
||||
options:
|
||||
items_per_page: 5
|
||||
style:
|
||||
type: default
|
||||
row:
|
||||
type: 'entity:entity_test'
|
||||
css_class: 'entity-test__default and_another-class'
|
||||
display_plugin: default
|
||||
display_title: Alternate
|
||||
id: display_2
|
||||
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- drupal:views
|
||||
|
||||
+6
@@ -37,6 +37,12 @@ class ArgumentValidatorTest extends ArgumentValidatorPluginBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateArgument($arg) {
|
||||
if ($arg === 'this value should be replaced') {
|
||||
// Set the argument to a numeric value so this is valid on PostgeSQL for
|
||||
// numeric fields.
|
||||
$this->argument->argument = '1';
|
||||
return TRUE;
|
||||
}
|
||||
return $arg == $this->options['test_value'];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class FieldFormButtonTest extends FieldPluginBase {
|
||||
if (!empty($triggering_element['#test_button'])) {
|
||||
$row_index = $triggering_element['#row_index'];
|
||||
$view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : $this->t('no arguments');
|
||||
drupal_set_message($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [
|
||||
$this->messenger()->addStatus($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [
|
||||
'@display' => $this->view->current_display,
|
||||
'@view_id' => $this->view->id(),
|
||||
'@args' => $view_args,
|
||||
|
||||
@@ -35,7 +35,6 @@ class JoinTest extends JoinPluginBase {
|
||||
$this->joinValue = $join_value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
+1
-2
@@ -60,7 +60,7 @@ class QueryTest extends QueryPluginBase {
|
||||
$this->conditions[] = [
|
||||
'field' => $field,
|
||||
'value' => $value,
|
||||
'operator' => $operator
|
||||
'operator' => $operator,
|
||||
];
|
||||
|
||||
}
|
||||
@@ -74,7 +74,6 @@ class QueryTest extends QueryPluginBase {
|
||||
$this->orderBy = ['field' => $field, 'order' => $order];
|
||||
}
|
||||
|
||||
|
||||
public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {
|
||||
// There is no concept of joins.
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- drupal:views
|
||||
|
||||
@@ -29,7 +29,7 @@ function views_test_data_install() {
|
||||
'p' => 'P',
|
||||
'strong' => 'STRONG',
|
||||
'em' => 'EM',
|
||||
'marquee' => 'MARQUEE'
|
||||
'marquee' => 'MARQUEE',
|
||||
];
|
||||
\Drupal::configFactory()->getEditable('views.settings')->set('field_rewrite_elements', $values)->save();
|
||||
}
|
||||
|
||||
@@ -129,5 +129,5 @@ function views_test_data_test_pre_render_function($element) {
|
||||
* Implements hook_form_BASE_FORM_ID_alter().
|
||||
*/
|
||||
function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, FormStateInterface $form_state, $form_id) {
|
||||
drupal_set_message(t('Test base form ID with Views forms and arguments.'));
|
||||
\Drupal::messenger()->addStatus(t('Test base form ID with Views forms and arguments.'));
|
||||
}
|
||||
|
||||
@@ -74,6 +74,11 @@ function views_test_data_placeholders() {
|
||||
*/
|
||||
function views_test_data_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
|
||||
\Drupal::state()->set('views_hook_test_views_post_render', TRUE);
|
||||
if ($view->storage->id() === 'test_page_display' && $view->current_display === 'empty_row') {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$output['#rows'][0]['#rows'][] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- drupal:views
|
||||
|
||||
@@ -5,5 +5,5 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- language
|
||||
- drupal:views
|
||||
- drupal:language
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\views_test_modal\Controller;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
class TestController extends ControllerBase {
|
||||
|
||||
/**
|
||||
* Renders a link to open the /admin/content view in a modal dialog.
|
||||
*/
|
||||
public function modal() {
|
||||
$build = [];
|
||||
|
||||
$build['open_admin_content'] = [
|
||||
'#type' => 'link',
|
||||
'#title' => $this->t('Administer content'),
|
||||
'#url' => Url::fromUserInput('/admin/content'),
|
||||
'#attributes' => [
|
||||
'class' => ['use-ajax'],
|
||||
'data-dialog-type' => 'modal',
|
||||
'data-dialog-options' => Json::encode([
|
||||
'dialogClass' => 'views-test-modal',
|
||||
'height' => '50%',
|
||||
'width' => '50%',
|
||||
'title' => $this->t('Administer content'),
|
||||
]),
|
||||
],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'core/drupal.dialog.ajax',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
name: 'Views Test Modal'
|
||||
type: module
|
||||
description: 'Provides a test page that renders a View in a modal.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- drupal:node
|
||||
- drupal:views
|
||||
@@ -0,0 +1,6 @@
|
||||
views_test_modal.modal:
|
||||
path: '/views-test-modal/modal'
|
||||
defaults:
|
||||
_controller: '\Drupal\views_test_modal\Controller\TestController::modal'
|
||||
requirements:
|
||||
_access: 'TRUE'
|
||||
@@ -4,7 +4,6 @@ namespace Drupal\Tests\views\Functional;
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\comment\Tests\CommentTestTrait;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Url;
|
||||
@@ -53,7 +52,7 @@ class DefaultViewsTest extends ViewTestBase {
|
||||
$vocabulary = Vocabulary::create([
|
||||
'name' => $this->randomMachineName(),
|
||||
'description' => $this->randomMachineName(),
|
||||
'vid' => Unicode::strtolower($this->randomMachineName()),
|
||||
'vid' => mb_strtolower($this->randomMachineName()),
|
||||
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
|
||||
'help' => '',
|
||||
'nodes' => ['page' => 'page'],
|
||||
@@ -62,7 +61,7 @@ class DefaultViewsTest extends ViewTestBase {
|
||||
$vocabulary->save();
|
||||
|
||||
// Create a field.
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
|
||||
$handler_settings = [
|
||||
'target_bundles' => [
|
||||
@@ -97,7 +96,7 @@ class DefaultViewsTest extends ViewTestBase {
|
||||
'status' => CommentInterface::PUBLISHED,
|
||||
'entity_id' => $node->id(),
|
||||
'entity_type' => 'node',
|
||||
'field_name' => 'comment'
|
||||
'field_name' => 'comment',
|
||||
];
|
||||
Comment::create($comment)->save();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class FieldEntityTest extends ViewTestBase {
|
||||
'uid' => $account->id(),
|
||||
'entity_id' => $node->id(),
|
||||
'entity_type' => 'node',
|
||||
'field_name' => 'comment'
|
||||
'field_name' => 'comment',
|
||||
]);
|
||||
$comment->save();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class FilterEntityBundleTest extends ViewTestBase {
|
||||
'node.type.test_bundle_2',
|
||||
],
|
||||
'module' => [
|
||||
'node'
|
||||
'node',
|
||||
],
|
||||
];
|
||||
$this->assertIdentical($expected, $view->getDependencies());
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\views\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\views\Tests\AssertViewsCacheTagsTrait;
|
||||
@@ -41,7 +40,7 @@ class GlossaryTest extends ViewTestBase {
|
||||
$nodes_by_char = [];
|
||||
foreach ($nodes_per_char as $char => $count) {
|
||||
$setting = [
|
||||
'type' => $type->id()
|
||||
'type' => $type->id(),
|
||||
];
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$node = $setting;
|
||||
@@ -109,7 +108,7 @@ class GlossaryTest extends ViewTestBase {
|
||||
$this->assertResponse(200);
|
||||
foreach ($nodes_per_char as $char => $count) {
|
||||
$href = Url::fromRoute('view.glossary.page_1', ['arg_0' => $char])->toString();
|
||||
$label = Unicode::strtoupper($char);
|
||||
$label = mb_strtoupper($char);
|
||||
// Get the summary link for a certain character. Filter by label and href
|
||||
// to ensure that both of them are correct.
|
||||
$result = $this->xpath('//a[contains(@href, :href) and normalize-space(text())=:label]/..', [':href' => $href, ':label' => $label]);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\views\Functional\Hal;
|
||||
|
||||
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
|
||||
use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase;
|
||||
|
||||
/**
|
||||
* @group hal
|
||||
*/
|
||||
class ViewHalJsonAnonTest extends ViewResourceTestBase {
|
||||
|
||||
use AnonResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['hal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'hal_json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/hal+json';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\views\Functional\Hal;
|
||||
|
||||
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
|
||||
use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase;
|
||||
|
||||
/**
|
||||
* @group hal
|
||||
*/
|
||||
class ViewHalJsonBasicAuthTest extends ViewResourceTestBase {
|
||||
|
||||
use BasicAuthResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['hal', 'basic_auth'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'hal_json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/hal+json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'basic_auth';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\views\Functional\Hal;
|
||||
|
||||
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
|
||||
use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase;
|
||||
|
||||
/**
|
||||
* @group hal
|
||||
*/
|
||||
class ViewHalJsonCookieTest extends ViewResourceTestBase {
|
||||
|
||||
use CookieResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['hal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'hal_json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/hal+json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'cookie';
|
||||
|
||||
}
|
||||
@@ -41,14 +41,13 @@ class AreaTest extends ViewTestBase {
|
||||
'title' => 'Test Example area',
|
||||
'help' => 'A area handler which just exists for tests.',
|
||||
'area' => [
|
||||
'id' => 'test_example'
|
||||
]
|
||||
'id' => 'test_example',
|
||||
],
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the generic UI of a area handler.
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Drupal\Tests\views\Functional\Handler;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Core\Render\RenderContext;
|
||||
use Drupal\Core\Url;
|
||||
@@ -484,7 +483,7 @@ class FieldWebTest extends ViewTestBase {
|
||||
'p',
|
||||
'strong',
|
||||
'em',
|
||||
'marquee'
|
||||
'marquee',
|
||||
];
|
||||
|
||||
$this->assertEqual(array_keys($element_types), $expected_elements);
|
||||
@@ -556,7 +555,7 @@ class FieldWebTest extends ViewTestBase {
|
||||
// Tests for simple trimming by string length.
|
||||
$row->views_test_data_name = $this->randomMachineName(8);
|
||||
$name_field->options['alter']['max_length'] = 5;
|
||||
$trimmed_name = Unicode::substr($row->views_test_data_name, 0, 5);
|
||||
$trimmed_name = mb_substr($row->views_test_data_name, 0, 5);
|
||||
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field, $row) {
|
||||
return $name_field->advancedRender($row);
|
||||
@@ -581,28 +580,28 @@ class FieldWebTest extends ViewTestBase {
|
||||
[
|
||||
'value' => $random_text_8,
|
||||
'trimmed_value' => '',
|
||||
'trimmed' => TRUE
|
||||
'trimmed' => TRUE,
|
||||
],
|
||||
// Create one string with two words which doesn't fit both into the limit.
|
||||
[
|
||||
'value' => $random_text_8 . ' ' . $random_text_8,
|
||||
'trimmed_value' => '',
|
||||
'trimmed' => TRUE
|
||||
'trimmed' => TRUE,
|
||||
],
|
||||
// Create one string which contains of two words, of which only the first
|
||||
// fits into the limit.
|
||||
[
|
||||
'value' => $random_text_4 . ' ' . $random_text_8,
|
||||
'trimmed_value' => $random_text_4,
|
||||
'trimmed' => TRUE
|
||||
'trimmed' => TRUE,
|
||||
],
|
||||
// Create one string which contains of two words, of which both fits into
|
||||
// the limit.
|
||||
[
|
||||
'value' => $random_text_2 . ' ' . $random_text_2,
|
||||
'trimmed_value' => $random_text_2 . ' ' . $random_text_2,
|
||||
'trimmed' => FALSE
|
||||
]
|
||||
'trimmed' => FALSE,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($tuples as $tuple) {
|
||||
|
||||
@@ -55,9 +55,9 @@ class ArgumentDefaultTest extends ViewTestBase {
|
||||
$options = [
|
||||
'default_argument_type' => 'argument_default_test',
|
||||
'default_argument_options' => [
|
||||
'value' => 'John'
|
||||
'value' => 'John',
|
||||
],
|
||||
'default_action' => 'default'
|
||||
'default_action' => 'default',
|
||||
];
|
||||
$id = $view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
|
||||
$view->initHandlers();
|
||||
@@ -81,7 +81,6 @@ class ArgumentDefaultTest extends ViewTestBase {
|
||||
$this->assertIdenticalResultset($view, $expected_result, ['views_test_data_name' => 'name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the use of a default argument plugin that provides no options.
|
||||
*/
|
||||
|
||||
@@ -51,8 +51,8 @@ class CacheWebTest extends ViewTestBase {
|
||||
'type' => 'time',
|
||||
'options' => [
|
||||
'results_lifespan' => '3600',
|
||||
'output_lifespan' => '3600'
|
||||
]
|
||||
'output_lifespan' => '3600',
|
||||
],
|
||||
]);
|
||||
$view->save();
|
||||
$this->container->get('router.builder')->rebuildIfNeeded();
|
||||
@@ -70,7 +70,7 @@ class CacheWebTest extends ViewTestBase {
|
||||
'config:user.role.anonymous',
|
||||
'config:views.view.test_display',
|
||||
'node_list',
|
||||
'rendered'
|
||||
'rendered',
|
||||
];
|
||||
$this->assertCacheTags($cache_tags);
|
||||
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ class ContextualFiltersBlockContextTest extends ViewTestBase {
|
||||
'label_display' => 'visible',
|
||||
'views_label' => '',
|
||||
'items_per_page' => 'none',
|
||||
'context_mapping' => ['nid' => '@node.node_route_context:node']
|
||||
'context_mapping' => ['nid' => '@node.node_route_context:node'],
|
||||
];
|
||||
$this->assertEqual($block->getPlugin()->getConfiguration(), $expected_settings, 'Block settings are correct.');
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ class DisplayAttachmentTest extends ViewTestBase {
|
||||
$this->drupalLogin($admin_user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the attachment plugin.
|
||||
*/
|
||||
|
||||
@@ -125,6 +125,10 @@ class DisplayEntityReferenceTest extends ViewTestBase {
|
||||
* Tests the entity reference display plugin.
|
||||
*/
|
||||
public function testEntityReferenceDisplay() {
|
||||
// Test that the 'title' settings are not shown.
|
||||
$this->drupalGet('admin/structure/views/view/test_display_entity_reference/edit/entity_reference_1');
|
||||
$this->assertSession()->linkByHrefNotExists('admin/structure/views/nojs/display/test_display_entity_reference/entity_reference_1/title');
|
||||
|
||||
// Add the new field to the fields.
|
||||
$this->drupalPostForm('admin/structure/views/nojs/add-handler/test_display_entity_reference/default/field', ['name[entity_test__' . $this->fieldName . '.' . $this->fieldName . ']' => TRUE], t('Add and configure fields'));
|
||||
$this->drupalPostForm(NULL, [], t('Apply'));
|
||||
|
||||
@@ -285,7 +285,7 @@ class DisplayTest extends ViewTestBase {
|
||||
'table' => 'views_test_data',
|
||||
'field' => 'id',
|
||||
'id' => 'id',
|
||||
'value' => ['value' => 7297]
|
||||
'value' => ['value' => 7297],
|
||||
];
|
||||
$view->setHandler('default', 'filter', 'id', $item);
|
||||
$this->executeView($view);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\views\Functional\Plugin;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
@@ -123,7 +122,7 @@ class ExposedFormCheckboxesTest extends ViewTestBase {
|
||||
}
|
||||
|
||||
// Create a field.
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
$handler_settings = [
|
||||
'target_bundles' => [
|
||||
$this->vocabulary->id() => $this->vocabulary->id(),
|
||||
|
||||
@@ -104,9 +104,9 @@ class ExposedFormTest extends ViewTestBase {
|
||||
'label' => 'Content: Type',
|
||||
'operator_id' => 'type_op',
|
||||
'reduce' => FALSE,
|
||||
'description' => 'Exposed overridden description'
|
||||
'description' => 'Exposed overridden description',
|
||||
],
|
||||
]
|
||||
],
|
||||
]);
|
||||
$view->save();
|
||||
$this->drupalGet('test_exposed_form_buttons', ['query' => [$identifier => 'article']]);
|
||||
@@ -131,9 +131,9 @@ class ExposedFormTest extends ViewTestBase {
|
||||
'label' => 'Content: Type',
|
||||
'operator_id' => 'type_op',
|
||||
'reduce' => FALSE,
|
||||
'description' => 'Exposed overridden description'
|
||||
'description' => 'Exposed overridden description',
|
||||
],
|
||||
]
|
||||
],
|
||||
]);
|
||||
$this->executeView($view);
|
||||
|
||||
@@ -286,7 +286,7 @@ class ExposedFormTest extends ViewTestBase {
|
||||
'entity_test_view_grants',
|
||||
'theme',
|
||||
'url.query_args',
|
||||
'languages:language_content'
|
||||
'languages:language_content',
|
||||
];
|
||||
|
||||
$this->drupalGet('test_exposed_form_sort_items_per_page');
|
||||
|
||||
@@ -418,7 +418,7 @@ class PagerTest extends ViewTestBase {
|
||||
// Create source string.
|
||||
$source = $this->localeStorage->createString(
|
||||
[
|
||||
'source' => $label
|
||||
'source' => $label,
|
||||
]
|
||||
);
|
||||
$source->save();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user