updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
opacity: 0.5;
|
||||
}
|
||||
.views-display-tab .details-wrapper > .views-ui-display-tab-bucket .actions {
|
||||
opacity: 1.0;
|
||||
opacity: 1;
|
||||
}
|
||||
.views-displays .tabs .add {
|
||||
position: relative;
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
background: linear-gradient(-90deg, #fff 0, #e8e8e8 100%) no-repeat, repeat-y;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 0 rgba(0,0,0,0.3333) inset;
|
||||
box-shadow: 0 0 0 rgba(0, 0, 0, 0.3333) inset;
|
||||
}
|
||||
.views-admin a.icon:hover {
|
||||
border-color: #d0d0d0;
|
||||
box-shadow: 0 0 1px rgba(0,0,0,0.3333) inset;
|
||||
box-shadow: 0 0 1px rgba(0, 0, 0, 0.3333) inset;
|
||||
}
|
||||
.views-admin a.icon:active {
|
||||
border-color: #c0c0c0;
|
||||
@@ -431,7 +431,7 @@ td.group-title {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.edit-display-settings {
|
||||
margin: 12px 12px 0 12px
|
||||
margin: 12px 12px 0 12px;
|
||||
}
|
||||
.edit-display-settings-top.views-ui-display-tab-bucket {
|
||||
border: 1px solid #f3f3f3;
|
||||
@@ -483,6 +483,7 @@ td.group-title {
|
||||
.view-preview-form .form-actions {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 45em) { /* 720px */
|
||||
.view-preview-form .form-type-textfield .description {
|
||||
white-space: nowrap;
|
||||
@@ -574,7 +575,7 @@ td.group-title {
|
||||
border-top: none;
|
||||
}
|
||||
.views-filterable-options {
|
||||
border-top: 1px solid #ccc;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
.filterable-option .form-item {
|
||||
margin-bottom: 0;
|
||||
@@ -623,10 +624,10 @@ td.group-title {
|
||||
border: none;
|
||||
}
|
||||
.views-ui-dialog .views-offset-top {
|
||||
border-bottom: 1px solid #CCC;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.views-ui-dialog .views-offset-bottom {
|
||||
border-top: 1px solid #CCC;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
.views-ui-dialog .views-override > * {
|
||||
margin: 0;
|
||||
|
||||
@@ -36,19 +36,19 @@
|
||||
// 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 $submit_buttons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
|
||||
$submit_buttons.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 () {
|
||||
const $form = $(this);
|
||||
const element_settings = {
|
||||
const elementSettings = {
|
||||
url: response.url,
|
||||
event: 'submit',
|
||||
base: $form.attr('id'),
|
||||
element: this,
|
||||
};
|
||||
const ajaxForm = Drupal.ajax(element_settings);
|
||||
const ajaxForm = Drupal.ajax(elementSettings);
|
||||
ajaxForm.$form = $form;
|
||||
});
|
||||
};
|
||||
@@ -159,9 +159,9 @@
|
||||
$('#views-tabset a').once('views-ajax').on('click', function () {
|
||||
const href = $(this).attr('href');
|
||||
// Cut of #views-tabset.
|
||||
const display_id = href.substr(11);
|
||||
const displayId = href.substr(11);
|
||||
// Set the form element.
|
||||
$('#views-live-preview #preview-display-id').val(display_id);
|
||||
$('#views-live-preview #preview-display-id').val(displayId);
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -177,20 +177,20 @@
|
||||
Drupal.behaviors.viewsAjax = {
|
||||
collapseReplaced: false,
|
||||
attach(context, settings) {
|
||||
const base_element_settings = {
|
||||
const baseElementSettings = {
|
||||
event: 'click',
|
||||
progress: { type: 'fullscreen' },
|
||||
};
|
||||
// Bind AJAX behaviors to all items showing the class.
|
||||
$('a.views-ajax-link', context).once('views-ajax').each(function () {
|
||||
const element_settings = base_element_settings;
|
||||
element_settings.base = $(this).attr('id');
|
||||
element_settings.element = this;
|
||||
const elementSettings = baseElementSettings;
|
||||
elementSettings.base = $(this).attr('id');
|
||||
elementSettings.element = this;
|
||||
// Set the URL to go to the anchor.
|
||||
if ($(this).attr('href')) {
|
||||
element_settings.url = $(this).attr('href');
|
||||
elementSettings.url = $(this).attr('href');
|
||||
}
|
||||
Drupal.ajax(element_settings);
|
||||
Drupal.ajax(elementSettings);
|
||||
});
|
||||
|
||||
$('div#views-live-preview a')
|
||||
@@ -200,18 +200,18 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
const element_settings = base_element_settings;
|
||||
const elementSettings = baseElementSettings;
|
||||
// Set the URL to go to the anchor.
|
||||
element_settings.url = $(this).attr('href');
|
||||
if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
elementSettings.url = $(this).attr('href');
|
||||
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
return true;
|
||||
}
|
||||
|
||||
element_settings.wrapper = 'views-preview-wrapper';
|
||||
element_settings.method = 'replaceWith';
|
||||
element_settings.base = $(this).attr('id');
|
||||
element_settings.element = this;
|
||||
Drupal.ajax(element_settings);
|
||||
elementSettings.wrapper = 'views-preview-wrapper';
|
||||
elementSettings.method = 'replaceWith';
|
||||
elementSettings.base = $(this).attr('id');
|
||||
elementSettings.element = this;
|
||||
Drupal.ajax(elementSettings);
|
||||
});
|
||||
|
||||
// Within a live preview, make exposed widget form buttons re-trigger the
|
||||
@@ -224,20 +224,20 @@
|
||||
this.form.clk = this;
|
||||
return true;
|
||||
});
|
||||
const element_settings = base_element_settings;
|
||||
const elementSettings = baseElementSettings;
|
||||
// Set the URL to go to the anchor.
|
||||
element_settings.url = $(this.form).attr('action');
|
||||
if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
elementSettings.url = $(this.form).attr('action');
|
||||
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
return true;
|
||||
}
|
||||
|
||||
element_settings.wrapper = 'views-preview-wrapper';
|
||||
element_settings.method = 'replaceWith';
|
||||
element_settings.event = 'click';
|
||||
element_settings.base = $(this).attr('id');
|
||||
element_settings.element = this;
|
||||
elementSettings.wrapper = 'views-preview-wrapper';
|
||||
elementSettings.method = 'replaceWith';
|
||||
elementSettings.event = 'click';
|
||||
elementSettings.base = $(this).attr('id');
|
||||
elementSettings.element = this;
|
||||
|
||||
Drupal.ajax(element_settings);
|
||||
Drupal.ajax(elementSettings);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) {
|
||||
var $form = $('.js-views-ui-dialog form');
|
||||
|
||||
var $submit_buttons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
|
||||
$submit_buttons.on('click mousedown', function () {
|
||||
var $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 () {
|
||||
var $form = $(this);
|
||||
var element_settings = {
|
||||
var elementSettings = {
|
||||
url: response.url,
|
||||
event: 'submit',
|
||||
base: $form.attr('id'),
|
||||
element: this
|
||||
};
|
||||
var ajaxForm = Drupal.ajax(element_settings);
|
||||
var ajaxForm = Drupal.ajax(elementSettings);
|
||||
ajaxForm.$form = $form;
|
||||
});
|
||||
};
|
||||
@@ -75,9 +75,9 @@
|
||||
$('#views-tabset a').once('views-ajax').on('click', function () {
|
||||
var href = $(this).attr('href');
|
||||
|
||||
var display_id = href.substr(11);
|
||||
var displayId = href.substr(11);
|
||||
|
||||
$('#views-live-preview #preview-display-id').val(display_id);
|
||||
$('#views-live-preview #preview-display-id').val(displayId);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -85,20 +85,20 @@
|
||||
Drupal.behaviors.viewsAjax = {
|
||||
collapseReplaced: false,
|
||||
attach: function attach(context, settings) {
|
||||
var base_element_settings = {
|
||||
var baseElementSettings = {
|
||||
event: 'click',
|
||||
progress: { type: 'fullscreen' }
|
||||
};
|
||||
|
||||
$('a.views-ajax-link', context).once('views-ajax').each(function () {
|
||||
var element_settings = base_element_settings;
|
||||
element_settings.base = $(this).attr('id');
|
||||
element_settings.element = this;
|
||||
var elementSettings = baseElementSettings;
|
||||
elementSettings.base = $(this).attr('id');
|
||||
elementSettings.element = this;
|
||||
|
||||
if ($(this).attr('href')) {
|
||||
element_settings.url = $(this).attr('href');
|
||||
elementSettings.url = $(this).attr('href');
|
||||
}
|
||||
Drupal.ajax(element_settings);
|
||||
Drupal.ajax(elementSettings);
|
||||
});
|
||||
|
||||
$('div#views-live-preview a').once('views-ajax').each(function () {
|
||||
@@ -106,18 +106,18 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
var element_settings = base_element_settings;
|
||||
var elementSettings = baseElementSettings;
|
||||
|
||||
element_settings.url = $(this).attr('href');
|
||||
if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
elementSettings.url = $(this).attr('href');
|
||||
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
return true;
|
||||
}
|
||||
|
||||
element_settings.wrapper = 'views-preview-wrapper';
|
||||
element_settings.method = 'replaceWith';
|
||||
element_settings.base = $(this).attr('id');
|
||||
element_settings.element = this;
|
||||
Drupal.ajax(element_settings);
|
||||
elementSettings.wrapper = 'views-preview-wrapper';
|
||||
elementSettings.method = 'replaceWith';
|
||||
elementSettings.base = $(this).attr('id');
|
||||
elementSettings.element = this;
|
||||
Drupal.ajax(elementSettings);
|
||||
});
|
||||
|
||||
$('div#views-live-preview input[type=submit]').once('views-ajax').each(function (event) {
|
||||
@@ -125,20 +125,20 @@
|
||||
this.form.clk = this;
|
||||
return true;
|
||||
});
|
||||
var element_settings = base_element_settings;
|
||||
var elementSettings = baseElementSettings;
|
||||
|
||||
element_settings.url = $(this.form).attr('action');
|
||||
if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
elementSettings.url = $(this.form).attr('action');
|
||||
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
|
||||
return true;
|
||||
}
|
||||
|
||||
element_settings.wrapper = 'views-preview-wrapper';
|
||||
element_settings.method = 'replaceWith';
|
||||
element_settings.event = 'click';
|
||||
element_settings.base = $(this).attr('id');
|
||||
element_settings.element = this;
|
||||
elementSettings.wrapper = 'views-preview-wrapper';
|
||||
elementSettings.method = 'replaceWith';
|
||||
elementSettings.event = 'click';
|
||||
elementSettings.base = $(this).attr('id');
|
||||
elementSettings.element = this;
|
||||
|
||||
Drupal.ajax(element_settings);
|
||||
Drupal.ajax(elementSettings);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -346,8 +346,15 @@
|
||||
|
||||
const $addDisplayDropdown = $(`<li class="add"><a href="#"><span class="icon add"></span>${Drupal.t('Add')}</a><ul class="action-list" style="display:none;"></ul></li>`);
|
||||
const $displayButtons = $menu.nextAll('input.add-display').detach();
|
||||
$displayButtons.appendTo($addDisplayDropdown.find('.action-list')).wrap('<li>')
|
||||
.parent().eq(0).addClass('first').end().eq(-1).addClass('last');
|
||||
$displayButtons
|
||||
.appendTo($addDisplayDropdown.find('.action-list'))
|
||||
.wrap('<li>')
|
||||
.parent()
|
||||
.eq(0)
|
||||
.addClass('first')
|
||||
.end()
|
||||
.eq(-1)
|
||||
.addClass('last');
|
||||
// Remove the 'Add ' prefix from the button labels since they're being
|
||||
// placed in an 'Add' dropdown. @todo This assumes English, but so does
|
||||
// $addDisplayDropdown above. Add support for translation.
|
||||
@@ -753,7 +760,6 @@
|
||||
* An operator element.
|
||||
*/
|
||||
duplicateGroupsOperator() {
|
||||
let dropdowns;
|
||||
let newRow;
|
||||
let titleRow;
|
||||
|
||||
@@ -770,7 +776,7 @@
|
||||
|
||||
// Keep a list of the operator dropdowns, so we can sync their behavior
|
||||
// later.
|
||||
dropdowns = this.operator;
|
||||
const dropdowns = this.operator;
|
||||
|
||||
// Move the operator to a new row just above the second group.
|
||||
titleRow = $('tr#views-group-title-2');
|
||||
@@ -1021,7 +1027,11 @@
|
||||
*/
|
||||
Drupal.behaviors.viewsRemoveIconClass = {
|
||||
attach(context) {
|
||||
$(context).find('.dropbutton').once('dropbutton-icon').find('.icon').removeClass('icon');
|
||||
$(context)
|
||||
.find('.dropbutton')
|
||||
.once('dropbutton-icon')
|
||||
.find('.icon')
|
||||
.removeClass('icon');
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1124,11 +1134,11 @@
|
||||
// Closures! :(
|
||||
const $context = $(context);
|
||||
const $submit = $context.find('[id^=edit-submit]');
|
||||
const old_value = $submit.val();
|
||||
const oldValue = $submit.val();
|
||||
|
||||
$submit.once('views-ui-override-button-text')
|
||||
.on('mouseup', function () {
|
||||
$(this).val(old_value);
|
||||
$(this).val(oldValue);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
@@ -372,7 +372,6 @@
|
||||
event.preventDefault();
|
||||
},
|
||||
duplicateGroupsOperator: function duplicateGroupsOperator() {
|
||||
var dropdowns = void 0;
|
||||
var newRow = void 0;
|
||||
var titleRow = void 0;
|
||||
|
||||
@@ -385,7 +384,7 @@
|
||||
this.operator.find('label').add('div.description').addClass('visually-hidden');
|
||||
this.operator.find('select').addClass('form-select');
|
||||
|
||||
dropdowns = this.operator;
|
||||
var dropdowns = this.operator;
|
||||
|
||||
titleRow = $('tr#views-group-title-2');
|
||||
newRow = $('<tr class="filter-group-operator-row"><td colspan="5"></td></tr>');
|
||||
@@ -587,10 +586,10 @@
|
||||
$(context).find('[data-drupal-selector="edit-override-dropdown"]').once('views-ui-override-button-text').each(function () {
|
||||
var $context = $(context);
|
||||
var $submit = $context.find('[id^=edit-submit]');
|
||||
var old_value = $submit.val();
|
||||
var oldValue = $submit.val();
|
||||
|
||||
$submit.once('views-ui-override-button-text').on('mouseup', function () {
|
||||
$(this).val(old_value);
|
||||
$(this).val(oldValue);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Form builder for the advanced admin settings page.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class AdvancedSettingsForm extends ConfigFormBase {
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Provides a form for adding an item in the Views UI.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class AddHandler extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Displays analysis information for a view.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class Analyze extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Provides a form for configuring an item in the Views UI.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ConfigHandler extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ use Drupal\views\ViewExecutable;
|
||||
|
||||
/**
|
||||
* Provides a form for configuring extra information for a Views UI item.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ConfigHandlerExtra extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ use Drupal\views\ViewExecutable;
|
||||
|
||||
/**
|
||||
* Provides a form for configuring grouping information for a Views UI handler.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ConfigHandlerGroup extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\views\ViewEntityInterface;
|
||||
|
||||
/**
|
||||
* Provides a form for editing the Views display.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class Display extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Provides a form for editing the details of a View.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class EditDetails extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ use Drupal\views\ViewExecutable;
|
||||
|
||||
/**
|
||||
* Provides a rearrange form for Views handlers.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class Rearrange extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ use Drupal\views\ViewExecutable;
|
||||
|
||||
/**
|
||||
* Provides a rearrange form for Views filters.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class RearrangeFilter extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Displays the display reorder form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ReorderDisplays extends ViewsFormBase {
|
||||
|
||||
|
||||
@@ -104,7 +104,9 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface {
|
||||
// Retrieve the first form from the stack without changing the integer keys,
|
||||
// as they're being used for the "2 of 3" progress indicator.
|
||||
reset($view->stack);
|
||||
list($key, $top) = each($view->stack);
|
||||
$key = key($view->stack);
|
||||
$top = current($view->stack);
|
||||
next($view->stack);
|
||||
unset($view->stack[$key]);
|
||||
|
||||
if (array_shift($top) != $identifier) {
|
||||
|
||||
@@ -10,6 +10,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Form builder for the admin display defaults page.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BasicSettingsForm extends ConfigFormBase {
|
||||
|
||||
|
||||
@@ -5,11 +5,13 @@ namespace Drupal\views_ui\Form;
|
||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\user\SharedTempStoreFactory;
|
||||
use Drupal\Core\TempStore\SharedTempStoreFactory;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Builds the form to break the lock of an edited view.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BreakLockForm extends EntityConfirmFormBase {
|
||||
|
||||
@@ -21,9 +23,9 @@ class BreakLockForm extends EntityConfirmFormBase {
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* Stores the user tempstore.
|
||||
* Stores the shared tempstore.
|
||||
*
|
||||
* @var \Drupal\user\SharedTempStore
|
||||
* @var \Drupal\Core\TempStore\SharedTempStore
|
||||
*/
|
||||
protected $tempStore;
|
||||
|
||||
@@ -32,7 +34,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The Entity manager.
|
||||
* @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
|
||||
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
|
||||
* The factory for the temp store object.
|
||||
*/
|
||||
public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory) {
|
||||
@@ -46,7 +48,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('entity.manager'),
|
||||
$container->get('user.shared_tempstore')
|
||||
$container->get('tempstore.shared')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use Drupal\Core\ParamConverter\AdminPathConfigEntityConverter;
|
||||
use Drupal\Core\Routing\AdminContext;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Drupal\Core\ParamConverter\ParamConverterInterface;
|
||||
use Drupal\user\SharedTempStoreFactory;
|
||||
use Drupal\Core\TempStore\SharedTempStoreFactory;
|
||||
use Drupal\views_ui\ViewUI;
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ class ViewUIConverter extends AdminPathConfigEntityConverter implements ParamCon
|
||||
/**
|
||||
* Stores the tempstore factory.
|
||||
*
|
||||
* @var \Drupal\user\SharedTempStoreFactory
|
||||
* @var \Drupal\Core\TempStore\SharedTempStoreFactory
|
||||
*/
|
||||
protected $tempStoreFactory;
|
||||
|
||||
@@ -41,7 +41,7 @@ class ViewUIConverter extends AdminPathConfigEntityConverter implements ParamCon
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
* @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
|
||||
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
|
||||
* The factory for the temp store object.
|
||||
*/
|
||||
public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory, ConfigFactoryInterface $config_factory = NULL, AdminContext $admin_context = NULL) {
|
||||
|
||||
@@ -36,8 +36,8 @@ abstract class UITestBase extends ViewTestBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
$this->enableViewsTestModule();
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Form controller for the Views edit form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ViewAddForm extends ViewFormBase {
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Form controller for the Views duplicate form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ViewDuplicateForm extends ViewFormBase {
|
||||
|
||||
|
||||
@@ -11,20 +11,23 @@ use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Render\ElementInfoManagerInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\user\SharedTempStoreFactory;
|
||||
use Drupal\Core\TempStore\SharedTempStoreFactory;
|
||||
use Drupal\views\Views;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;
|
||||
|
||||
/**
|
||||
* Form controller for the Views edit form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ViewEditForm extends ViewFormBase {
|
||||
|
||||
/**
|
||||
* The views temp store.
|
||||
*
|
||||
* @var \Drupal\user\SharedTempStore
|
||||
* @var \Drupal\Core\TempStore\SharedTempStore
|
||||
*/
|
||||
protected $tempStore;
|
||||
|
||||
@@ -52,7 +55,7 @@ class ViewEditForm extends ViewFormBase {
|
||||
/**
|
||||
* Constructs a new ViewEditForm object.
|
||||
*
|
||||
* @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
|
||||
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
|
||||
* The factory for the temp store object.
|
||||
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
|
||||
* The request stack object.
|
||||
@@ -73,7 +76,7 @@ class ViewEditForm extends ViewFormBase {
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('user.shared_tempstore'),
|
||||
$container->get('tempstore.shared'),
|
||||
$container->get('request_stack'),
|
||||
$container->get('date.formatter'),
|
||||
$container->get('element_info')
|
||||
@@ -416,15 +419,25 @@ class ViewEditForm extends ViewFormBase {
|
||||
// path.
|
||||
elseif ($view->status() && $view->getExecutable()->displayHandlers->get($display['id'])->hasPath()) {
|
||||
$path = $view->getExecutable()->displayHandlers->get($display['id'])->getPath();
|
||||
|
||||
if ($path && (strpos($path, '%') === FALSE)) {
|
||||
if (!parse_url($path, PHP_URL_SCHEME)) {
|
||||
// @todo Views should expect and store a leading /. See:
|
||||
// https://www.drupal.org/node/2423913
|
||||
$url = Url::fromUserInput('/' . ltrim($path, '/'));
|
||||
// Wrap this in a try/catch as trying to generate links to some
|
||||
// routes may throw a NotAcceptableHttpException if they do not
|
||||
// respond to HTML, such as RESTExports.
|
||||
try {
|
||||
if (!parse_url($path, PHP_URL_SCHEME)) {
|
||||
// @todo Views should expect and store a leading /. See:
|
||||
// https://www.drupal.org/node/2423913
|
||||
$url = Url::fromUserInput('/' . ltrim($path, '/'));
|
||||
}
|
||||
else {
|
||||
$url = Url::fromUri("base:$path");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$url = Url::fromUri("base:$path");
|
||||
catch (NotAcceptableHttpException $e) {
|
||||
$url = '/' . $path;
|
||||
}
|
||||
|
||||
$build['top']['actions']['path'] = [
|
||||
'#type' => 'link',
|
||||
'#title' => $this->t('View @display_title', ['@display_title' => $display_title]),
|
||||
|
||||
@@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;
|
||||
|
||||
/**
|
||||
* Defines a class to build a listing of view entities.
|
||||
@@ -255,9 +256,17 @@ class ViewListBuilder extends ConfigEntityListBuilder {
|
||||
if ($display->hasPath()) {
|
||||
$path = $display->getPath();
|
||||
if ($view->status() && strpos($path, '%') === FALSE) {
|
||||
// @todo Views should expect and store a leading /. See:
|
||||
// https://www.drupal.org/node/2423913
|
||||
$rendered_path = \Drupal::l('/' . $path, Url::fromUserInput('/' . $path));
|
||||
// Wrap this in a try/catch as trying to generate links to some
|
||||
// routes may throw a NotAcceptableHttpException if they do not
|
||||
// respond to HTML, such as RESTExports.
|
||||
try {
|
||||
// @todo Views should expect and store a leading /. See:
|
||||
// https://www.drupal.org/node/2423913
|
||||
$rendered_path = \Drupal::l('/' . $path, Url::fromUserInput('/' . $path));
|
||||
}
|
||||
catch (NotAcceptableHttpException $e) {
|
||||
$rendered_path = '/' . $path;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rendered_path = '/' . $path;
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Form controller for the Views preview form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ViewPreviewForm extends ViewFormBase {
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class ViewUI implements ViewEntityInterface {
|
||||
* If this view is locked for editing.
|
||||
*
|
||||
* If this view is locked it will contain the result of
|
||||
* \Drupal\user\SharedTempStore::getMetadata(). Which can be a stdClass or
|
||||
* \Drupal\Core\TempStore\SharedTempStore::getMetadata(). Which can be a stdClass or
|
||||
* NULL.
|
||||
*
|
||||
* @var stdClass
|
||||
@@ -855,7 +855,7 @@ class ViewUI implements ViewEntityInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a cached view object in the user tempstore.
|
||||
* Sets a cached view object in the shared tempstore.
|
||||
*/
|
||||
public function cacheSet() {
|
||||
if ($this->isLocked()) {
|
||||
@@ -878,7 +878,7 @@ class ViewUI implements ViewEntityInterface {
|
||||
$executable->default_display = NULL;
|
||||
$executable->query = NULL;
|
||||
$executable->displayHandlers = NULL;
|
||||
\Drupal::service('user.shared_tempstore')->get('views')->set($this->id(), $this);
|
||||
\Drupal::service('tempstore.shared')->get('views')->set($this->id(), $this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- views_ui
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
# Information added by Drupal.org packaging script on 2018-03-07
|
||||
version: '8.5.0'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1515021228
|
||||
datestamp: 1520457825
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- views_ui
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
# Information added by Drupal.org packaging script on 2018-03-07
|
||||
version: '8.5.0'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1515021228
|
||||
datestamp: 1520457825
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\Tests\views_ui\Functional;
|
||||
|
||||
/**
|
||||
* Tests the user tempstore cache in the UI.
|
||||
* Tests the shared tempstore cache in the UI.
|
||||
*
|
||||
* @group views_ui
|
||||
*/
|
||||
@@ -17,12 +17,12 @@ class CachedDataUITest extends UITestBase {
|
||||
public static $testViews = ['test_view'];
|
||||
|
||||
/**
|
||||
* Tests the user tempstore views data in the UI.
|
||||
* Tests the shared tempstore views data in the UI.
|
||||
*/
|
||||
public function testCacheData() {
|
||||
$views_admin_user_uid = $this->fullAdminUser->id();
|
||||
|
||||
$temp_store = $this->container->get('user.shared_tempstore')->get('views');
|
||||
$temp_store = $this->container->get('tempstore.shared')->get('views');
|
||||
// The view should not be locked.
|
||||
$this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'The view is not locked.');
|
||||
|
||||
@@ -40,7 +40,7 @@ class CachedDataUITest extends UITestBase {
|
||||
|
||||
// Cancel the view edit and make sure the cache is deleted.
|
||||
$this->drupalPostForm(NULL, [], t('Cancel'));
|
||||
$this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'User tempstore data has been removed.');
|
||||
$this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'Shared tempstore data has been removed.');
|
||||
// Test we are redirected to the view listing page.
|
||||
$this->assertUrl('admin/structure/views', [], 'Redirected back to the view listing page.');
|
||||
|
||||
|
||||
@@ -143,6 +143,16 @@ class DisplayCRUDTest extends UITestBase {
|
||||
$this->assertFalse(isset($block_1->display['display_options']['path']));
|
||||
$this->assertEqual($block_1->getOption('title'), $random_title, 'The overridden title option from the display got copied into the duplicate');
|
||||
$this->assertEqual($block_1->getOption('css_class'), $random_css, 'The overridden css_class option from the display got copied into the duplicate');
|
||||
|
||||
// Test duplicating a display after changing the machine name.
|
||||
$view_id = $view->id();
|
||||
$this->drupalPostForm("admin/structure/views/nojs/display/$view_id/page_2/display_id", ['display_id' => 'page_new'], 'Apply');
|
||||
$this->drupalPostForm(NULL, [], 'Duplicate as Block');
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$view = Views::getView($view_id);
|
||||
$view->initDisplay();
|
||||
$this->assertNotNull($view->displayHandlers->get('page_new'), 'The original display is saved with a changed id');
|
||||
$this->assertNotNull($view->displayHandlers->get('block_2'), 'The duplicate display is saved with new id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class DisplayTest extends UITestBase {
|
||||
$view = $this->randomView();
|
||||
$id = $view['id'];
|
||||
|
||||
// The view should initially have the enabled class on it's form wrapper.
|
||||
// The view should initially have the enabled class on its form wrapper.
|
||||
$this->drupalGet('admin/structure/views/view/' . $id);
|
||||
$elements = $this->xpath('//div[contains(@class, :edit) and contains(@class, :status)]', [':edit' => 'views-edit-view', ':status' => 'enabled']);
|
||||
$this->assertTrue($elements, 'The enabled class was found on the form wrapper');
|
||||
|
||||
@@ -8,8 +8,8 @@ configure: entity.view.collection
|
||||
dependencies:
|
||||
- views
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
# Information added by Drupal.org packaging script on 2018-03-07
|
||||
version: '8.5.0'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1515021228
|
||||
datestamp: 1520457825
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
paramconverter.views_ui:
|
||||
class: Drupal\views_ui\ParamConverter\ViewUIConverter
|
||||
arguments: ['@entity.manager', '@user.shared_tempstore', '@config.factory', '@router.admin_context']
|
||||
arguments: ['@entity.manager', '@tempstore.shared', '@config.factory', '@router.admin_context']
|
||||
tags:
|
||||
- { name: paramconverter, priority: 10 }
|
||||
lazy: true
|
||||
|
||||
Reference in New Issue
Block a user