Issue #2803375 by cilefen, tedbow, saurabh-chugh, Wim Leers: Rename Outside-in module to "Settings Tray" for real
parent
271134ee22
commit
e2e1f61c5f
|
@ -311,9 +311,6 @@ Node Access
|
|||
Options
|
||||
- ?
|
||||
|
||||
Outside In
|
||||
- Ted Bowman 'tedbow' https://www.drupal.org/u/tedbow
|
||||
|
||||
Page Cache
|
||||
- Lorenz Schori 'znerol' https://www.drupal.org/u/znerol
|
||||
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
|
||||
|
@ -360,6 +357,9 @@ Search
|
|||
Serialization
|
||||
- Damian Lee 'damiankloip' https://www.drupal.org/u/damiankloip
|
||||
|
||||
Settings Tray
|
||||
- Ted Bowman 'tedbow' https://www.drupal.org/u/tedbow
|
||||
|
||||
Seven
|
||||
- ?
|
||||
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
"drupal/migrate_drupal_ui": "self.version",
|
||||
"drupal/node": "self.version",
|
||||
"drupal/options": "self.version",
|
||||
"drupal/outside_in": "self.version",
|
||||
"drupal/page_cache": "self.version",
|
||||
"drupal/path": "self.version",
|
||||
"drupal/quickedit": "self.version",
|
||||
|
@ -132,6 +131,7 @@
|
|||
"drupal/rest": "self.version",
|
||||
"drupal/search": "self.version",
|
||||
"drupal/serialization": "self.version",
|
||||
"drupal/settings_tray": "self.version",
|
||||
"drupal/seven": "self.version",
|
||||
"drupal/shortcut": "self.version",
|
||||
"drupal/simpletest": "self.version",
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
float: right;
|
||||
}
|
||||
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode a,
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode input {
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode a,
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode input {
|
||||
pointer-events: none;
|
||||
}
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode .contextual-links a {
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode .contextual-links a {
|
||||
pointer-events: inherit;
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
/* Transition the editables on the page, their contextual links and their hover states. */
|
||||
.dialog-off-canvas__main-canvas .contextual,
|
||||
.dialog-off-canvas__main-canvas .js-outside-in-edit-mode .outside-in-editable,
|
||||
.dialog-off-canvas__main-canvas.js-tray-open .js-outside-in-edit-mode .outside-in-editable {
|
||||
.dialog-off-canvas__main-canvas .js-settings-tray-edit-mode .settings-tray-editable,
|
||||
.dialog-off-canvas__main-canvas.js-tray-open .js-settings-tray-edit-mode .settings-tray-editable {
|
||||
transition: all .7s ease;
|
||||
}
|
|
@ -8,13 +8,13 @@
|
|||
*/
|
||||
|
||||
/* Style the edit mode toolbar and tabs. */
|
||||
#toolbar-bar.js-outside-in-edit-mode {
|
||||
#toolbar-bar.js-settings-tray-edit-mode {
|
||||
background-image: linear-gradient(to bottom,#0c97ed,#1f86c7);
|
||||
}
|
||||
.js-outside-in-edit-mode .toolbar-item:not(.toolbar-icon-edit) {
|
||||
.js-settings-tray-edit-mode .toolbar-item:not(.toolbar-icon-edit) {
|
||||
color: #999;
|
||||
}
|
||||
.js-outside-in-edit-mode .toolbar-item:not(.toolbar-icon-edit) .is-active {
|
||||
.js-settings-tray-edit-mode .toolbar-item:not(.toolbar-icon-edit) .is-active {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,11 @@
|
|||
}
|
||||
|
||||
/* Style the editables while in edit mode. */
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode .outside-in-editable {
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode .settings-tray-editable {
|
||||
outline: 1px dashed rgba(0,0,0,0.5);
|
||||
box-shadow: 0 0 0 1px rgba(255,255,255,0.7);
|
||||
}
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode .outside-in-editable:hover,
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode .outside-in-editable.outside-in-active-editable {
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode .settings-tray-editable:hover,
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode .settings-tray-editable.settings-tray-active-editable {
|
||||
background-color: rgba(0,0,0,0.2);
|
||||
}
|
|
@ -8,13 +8,13 @@
|
|||
*/
|
||||
|
||||
/* Style the edit mode toolbar and tabs. */
|
||||
#toolbar-bar.js-outside-in-edit-mode {
|
||||
#toolbar-bar.js-settings-tray-edit-mode {
|
||||
background-color: #fff;
|
||||
}
|
||||
#toolbar-bar.js-outside-in-edit-mode .toolbar-item {
|
||||
#toolbar-bar.js-settings-tray-edit-mode .toolbar-item {
|
||||
color: #999;
|
||||
}
|
||||
#toolbar-bar.js-outside-in-edit-mode .toolbar-item .is-active {
|
||||
#toolbar-bar.js-settings-tray-edit-mode .toolbar-item .is-active {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,10 @@ button.toolbar-icon.toolbar-icon-edit.toolbar-item:before:focus {
|
|||
background-image: url(../../../misc/icons/ffffff/pencil.svg);
|
||||
}
|
||||
|
||||
#toolbar-bar.js-outside-in-edit-mode button.toolbar-icon.toolbar-icon-edit.toolbar-item.is-active {
|
||||
#toolbar-bar.js-settings-tray-edit-mode button.toolbar-icon.toolbar-icon-edit.toolbar-item.is-active {
|
||||
background-image: none;
|
||||
color: #fff;
|
||||
}
|
||||
#toolbar-bar.js-outside-in-edit-mode button.toolbar-icon.toolbar-icon-edit.toolbar-item.is-active:hover {
|
||||
#toolbar-bar.js-settings-tray-edit-mode button.toolbar-icon.toolbar-icon-edit.toolbar-item.is-active:hover {
|
||||
background-image: linear-gradient(to bottom, #0094f0, #0e69be);
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
/**
|
||||
* The minimum width to use body displace needs to match the width at which
|
||||
* the tray will be %100 width. @see outside_in.module.css
|
||||
* the tray will be %100 width. @see settings_tray.module.css
|
||||
* @type {Number}
|
||||
*/
|
||||
minDisplaceWidth: 768,
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
const blockConfigureSelector = '[data-outside-in-edit]';
|
||||
const toggleEditSelector = '[data-drupal-outsidein="toggle"]';
|
||||
const itemsToToggleSelector = '[data-off-canvas-main-canvas], #toolbar-bar, [data-drupal-outsidein="editable"] a, [data-drupal-outsidein="editable"] button';
|
||||
const blockConfigureSelector = '[data-settings-tray-edit]';
|
||||
const toggleEditSelector = '[data-drupal-settingstray="toggle"]';
|
||||
const itemsToToggleSelector = '[data-off-canvas-main-canvas], #toolbar-bar, [data-drupal-settingstray="editable"] a, [data-drupal-settingstray="editable"] button';
|
||||
const contextualItemsSelector = '[data-contextual-id] a, [data-contextual-id] button';
|
||||
const quickEditItemSelector = '[data-quickedit-entity-id]';
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
function setEditModeState(editMode) {
|
||||
if (!document.querySelector('[data-off-canvas-main-canvas]')) {
|
||||
throw new Error('data-off-canvas-main-canvas is missing from outside-in-page-wrapper.html.twig');
|
||||
throw new Error('data-off-canvas-main-canvas is missing from settings-tray-page-wrapper.html.twig');
|
||||
}
|
||||
editMode = !!editMode;
|
||||
const $editButton = $(toggleEditSelector);
|
||||
|
@ -77,16 +77,16 @@
|
|||
$editButton.text(Drupal.t('Editing'));
|
||||
closeToolbarTrays();
|
||||
|
||||
$editables = $('[data-drupal-outsidein="editable"]').once('outsidein');
|
||||
$editables = $('[data-drupal-settingstray="editable"]').once('settingstray');
|
||||
if ($editables.length) {
|
||||
// Use event capture to prevent clicks on links.
|
||||
document.querySelector('[data-off-canvas-main-canvas]').addEventListener('click', preventClick, true);
|
||||
|
||||
// When a click occurs try and find the outside-in edit link
|
||||
// When a click occurs try and find the settings-tray edit link
|
||||
// and click it.
|
||||
$editables
|
||||
.not(contextualItemsSelector)
|
||||
.on('click.outsidein', (e) => {
|
||||
.on('click.settingstray', (e) => {
|
||||
// Contextual links are allowed to function in Edit mode.
|
||||
if ($(e.target).closest('.contextual').length || !localStorage.getItem('Drupal.contextualToolbar.isViewing')) {
|
||||
return;
|
||||
|
@ -96,7 +96,7 @@
|
|||
});
|
||||
$(quickEditItemSelector)
|
||||
.not(contextualItemsSelector)
|
||||
.on('click.outsidein', (e) => {
|
||||
.on('click.settingstray', (e) => {
|
||||
/**
|
||||
* For all non-contextual links or the contextual QuickEdit link
|
||||
* close the off-canvas dialog.
|
||||
|
@ -114,31 +114,31 @@
|
|||
}
|
||||
// Disable edit mode.
|
||||
else {
|
||||
$editables = $('[data-drupal-outsidein="editable"]').removeOnce('outsidein');
|
||||
$editables = $('[data-drupal-settingstray="editable"]').removeOnce('settingstray');
|
||||
if ($editables.length) {
|
||||
document.querySelector('[data-off-canvas-main-canvas]').removeEventListener('click', preventClick, true);
|
||||
$editables.off('.outsidein');
|
||||
$(quickEditItemSelector).off('.outsidein');
|
||||
$editables.off('.settingstray');
|
||||
$(quickEditItemSelector).off('.settingstray');
|
||||
}
|
||||
|
||||
$editButton.text(Drupal.t('Edit'));
|
||||
closeOffCanvas();
|
||||
disableQuickEdit();
|
||||
}
|
||||
getItemsToToggle().toggleClass('js-outside-in-edit-mode', editMode);
|
||||
getItemsToToggle().toggleClass('js-settings-tray-edit-mode', editMode);
|
||||
$('.edit-mode-inactive').toggleClass('visually-hidden', editMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to check the state of the outside-in mode.
|
||||
* Helper to check the state of the settings-tray mode.
|
||||
*
|
||||
* @todo don't use a class for this.
|
||||
*
|
||||
* @return {boolean}
|
||||
* State of the outside-in edit mode.
|
||||
* State of the settings-tray edit mode.
|
||||
*/
|
||||
function isInEditMode() {
|
||||
return $('#toolbar-bar').hasClass('js-outside-in-edit-mode');
|
||||
return $('#toolbar-bar').hasClass('js-settings-tray-edit-mode');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,7 +161,7 @@
|
|||
$(document).on('drupalContextualLinkAdded', (event, data) => {
|
||||
|
||||
// When the first contextual link is added to the page set Edit Mode.
|
||||
$('body').once('outside_in.edit_mode_init').each(() => {
|
||||
$('body').once('settings_tray.edit_mode_init').each(() => {
|
||||
const editMode = localStorage.getItem('Drupal.contextualToolbar.isViewing') === 'false';
|
||||
if (editMode) {
|
||||
setEditModeState(true);
|
||||
|
@ -180,9 +180,9 @@
|
|||
* mode also.
|
||||
*/
|
||||
data.$el.find(blockConfigureSelector)
|
||||
.on('click.outsidein', () => {
|
||||
.on('click.settingstray', () => {
|
||||
if (!isInEditMode()) {
|
||||
$(toggleEditSelector).trigger('click').trigger('click.outside_in');
|
||||
$(toggleEditSelector).trigger('click').trigger('click.settings_tray');
|
||||
}
|
||||
/**
|
||||
* Always disable QuickEdit regardless of whether "EditMode" was just
|
||||
|
@ -192,7 +192,7 @@
|
|||
});
|
||||
});
|
||||
|
||||
$(document).on('keyup.outsidein', (e) => {
|
||||
$(document).on('keyup.settingstray', (e) => {
|
||||
if (isInEditMode() && e.keyCode === 27) {
|
||||
Drupal.announce(
|
||||
Drupal.t('Exited edit mode.'),
|
||||
|
@ -202,16 +202,16 @@
|
|||
});
|
||||
|
||||
/**
|
||||
* Toggle the js-outside-edit-mode class on items that we want to disable while in edit mode.
|
||||
* Toggle the js-settings-tray-edit-mode class on items that we want to disable while in edit mode.
|
||||
*
|
||||
* @type {Drupal~behavior}
|
||||
*
|
||||
* @prop {Drupal~behaviorAttach} attach
|
||||
* Toggle the js-outside-edit-mode class.
|
||||
* Toggle the js-settings-tray-edit-mode class.
|
||||
*/
|
||||
Drupal.behaviors.toggleEditMode = {
|
||||
attach() {
|
||||
$(toggleEditSelector).once('outsidein').on('click.outsidein', toggleEditMode);
|
||||
$(toggleEditSelector).once('settingstray').on('click.settingstray', toggleEditMode);
|
||||
// Find all Ajax instances that use the 'off_canvas' renderer.
|
||||
Drupal.ajax.instances
|
||||
// If there is an element and the renderer is 'off_canvas' then we want
|
||||
|
@ -224,7 +224,7 @@
|
|||
if (!('dialogOptions' in instance.options.data)) {
|
||||
instance.options.data.dialogOptions = {};
|
||||
}
|
||||
instance.options.data.dialogOptions.outsideInActiveEditableId = $(instance.element).parents('.outside-in-editable').attr('id');
|
||||
instance.options.data.dialogOptions.settingsTrayActiveEditableId = $(instance.element).parents('.settings-tray-editable').attr('id');
|
||||
instance.progress = { type: 'fullscreen' };
|
||||
});
|
||||
},
|
||||
|
@ -234,16 +234,16 @@
|
|||
$(window).on({
|
||||
'dialog:beforecreate': (event, dialog, $element, settings) => {
|
||||
if ($element.is('#drupal-off-canvas')) {
|
||||
$('body .outside-in-active-editable').removeClass('outside-in-active-editable');
|
||||
const $activeElement = $(`#${settings.outsideInActiveEditableId}`);
|
||||
$('body .settings-tray-active-editable').removeClass('settings-tray-active-editable');
|
||||
const $activeElement = $(`#${settings.settingsTrayActiveEditableId}`);
|
||||
if ($activeElement.length) {
|
||||
$activeElement.addClass('outside-in-active-editable');
|
||||
$activeElement.addClass('settings-tray-active-editable');
|
||||
}
|
||||
}
|
||||
},
|
||||
'dialog:beforeclose': (event, dialog, $element) => {
|
||||
if ($element.is('#drupal-off-canvas')) {
|
||||
$('body .outside-in-active-editable').removeClass('outside-in-active-editable');
|
||||
$('body .settings-tray-active-editable').removeClass('settings-tray-active-editable');
|
||||
}
|
||||
},
|
||||
});
|
|
@ -6,9 +6,9 @@
|
|||
**/
|
||||
|
||||
(function ($, Drupal) {
|
||||
var blockConfigureSelector = '[data-outside-in-edit]';
|
||||
var toggleEditSelector = '[data-drupal-outsidein="toggle"]';
|
||||
var itemsToToggleSelector = '[data-off-canvas-main-canvas], #toolbar-bar, [data-drupal-outsidein="editable"] a, [data-drupal-outsidein="editable"] button';
|
||||
var blockConfigureSelector = '[data-settings-tray-edit]';
|
||||
var toggleEditSelector = '[data-drupal-settingstray="toggle"]';
|
||||
var itemsToToggleSelector = '[data-off-canvas-main-canvas], #toolbar-bar, [data-drupal-settingstray="editable"] a, [data-drupal-settingstray="editable"] button';
|
||||
var contextualItemsSelector = '[data-contextual-id] a, [data-contextual-id] button';
|
||||
var quickEditItemSelector = '[data-quickedit-entity-id]';
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
function setEditModeState(editMode) {
|
||||
if (!document.querySelector('[data-off-canvas-main-canvas]')) {
|
||||
throw new Error('data-off-canvas-main-canvas is missing from outside-in-page-wrapper.html.twig');
|
||||
throw new Error('data-off-canvas-main-canvas is missing from settings-tray-page-wrapper.html.twig');
|
||||
}
|
||||
editMode = !!editMode;
|
||||
var $editButton = $(toggleEditSelector);
|
||||
|
@ -47,18 +47,18 @@
|
|||
$editButton.text(Drupal.t('Editing'));
|
||||
closeToolbarTrays();
|
||||
|
||||
$editables = $('[data-drupal-outsidein="editable"]').once('outsidein');
|
||||
$editables = $('[data-drupal-settingstray="editable"]').once('settingstray');
|
||||
if ($editables.length) {
|
||||
document.querySelector('[data-off-canvas-main-canvas]').addEventListener('click', preventClick, true);
|
||||
|
||||
$editables.not(contextualItemsSelector).on('click.outsidein', function (e) {
|
||||
$editables.not(contextualItemsSelector).on('click.settingstray', function (e) {
|
||||
if ($(e.target).closest('.contextual').length || !localStorage.getItem('Drupal.contextualToolbar.isViewing')) {
|
||||
return;
|
||||
}
|
||||
$(e.currentTarget).find(blockConfigureSelector).trigger('click');
|
||||
disableQuickEdit();
|
||||
});
|
||||
$(quickEditItemSelector).not(contextualItemsSelector).on('click.outsidein', function (e) {
|
||||
$(quickEditItemSelector).not(contextualItemsSelector).on('click.settingstray', function (e) {
|
||||
if (!$(e.target).parent().hasClass('contextual') || $(e.target).parent().hasClass('quickedit')) {
|
||||
closeOffCanvas();
|
||||
}
|
||||
|
@ -70,23 +70,23 @@
|
|||
});
|
||||
}
|
||||
} else {
|
||||
$editables = $('[data-drupal-outsidein="editable"]').removeOnce('outsidein');
|
||||
$editables = $('[data-drupal-settingstray="editable"]').removeOnce('settingstray');
|
||||
if ($editables.length) {
|
||||
document.querySelector('[data-off-canvas-main-canvas]').removeEventListener('click', preventClick, true);
|
||||
$editables.off('.outsidein');
|
||||
$(quickEditItemSelector).off('.outsidein');
|
||||
$editables.off('.settingstray');
|
||||
$(quickEditItemSelector).off('.settingstray');
|
||||
}
|
||||
|
||||
$editButton.text(Drupal.t('Edit'));
|
||||
closeOffCanvas();
|
||||
disableQuickEdit();
|
||||
}
|
||||
getItemsToToggle().toggleClass('js-outside-in-edit-mode', editMode);
|
||||
getItemsToToggle().toggleClass('js-settings-tray-edit-mode', editMode);
|
||||
$('.edit-mode-inactive').toggleClass('visually-hidden', editMode);
|
||||
}
|
||||
|
||||
function isInEditMode() {
|
||||
return $('#toolbar-bar').hasClass('js-outside-in-edit-mode');
|
||||
return $('#toolbar-bar').hasClass('js-settings-tray-edit-mode');
|
||||
}
|
||||
|
||||
function toggleEditMode() {
|
||||
|
@ -94,7 +94,7 @@
|
|||
}
|
||||
|
||||
$(document).on('drupalContextualLinkAdded', function (event, data) {
|
||||
$('body').once('outside_in.edit_mode_init').each(function () {
|
||||
$('body').once('settings_tray.edit_mode_init').each(function () {
|
||||
var editMode = localStorage.getItem('Drupal.contextualToolbar.isViewing') === 'false';
|
||||
if (editMode) {
|
||||
setEditModeState(true);
|
||||
|
@ -103,16 +103,16 @@
|
|||
|
||||
Drupal.attachBehaviors(data.$el[0]);
|
||||
|
||||
data.$el.find(blockConfigureSelector).on('click.outsidein', function () {
|
||||
data.$el.find(blockConfigureSelector).on('click.settingstray', function () {
|
||||
if (!isInEditMode()) {
|
||||
$(toggleEditSelector).trigger('click').trigger('click.outside_in');
|
||||
$(toggleEditSelector).trigger('click').trigger('click.settings_tray');
|
||||
}
|
||||
|
||||
disableQuickEdit();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('keyup.outsidein', function (e) {
|
||||
$(document).on('keyup.settingstray', function (e) {
|
||||
if (isInEditMode() && e.keyCode === 27) {
|
||||
Drupal.announce(Drupal.t('Exited edit mode.'));
|
||||
toggleEditMode();
|
||||
|
@ -121,7 +121,7 @@
|
|||
|
||||
Drupal.behaviors.toggleEditMode = {
|
||||
attach: function attach() {
|
||||
$(toggleEditSelector).once('outsidein').on('click.outsidein', toggleEditMode);
|
||||
$(toggleEditSelector).once('settingstray').on('click.settingstray', toggleEditMode);
|
||||
|
||||
Drupal.ajax.instances.filter(function (instance) {
|
||||
return instance && $(instance.element).attr('data-dialog-renderer') === 'off_canvas';
|
||||
|
@ -129,7 +129,7 @@
|
|||
if (!('dialogOptions' in instance.options.data)) {
|
||||
instance.options.data.dialogOptions = {};
|
||||
}
|
||||
instance.options.data.dialogOptions.outsideInActiveEditableId = $(instance.element).parents('.outside-in-editable').attr('id');
|
||||
instance.options.data.dialogOptions.settingsTrayActiveEditableId = $(instance.element).parents('.settings-tray-editable').attr('id');
|
||||
instance.progress = { type: 'fullscreen' };
|
||||
});
|
||||
}
|
||||
|
@ -138,16 +138,16 @@
|
|||
$(window).on({
|
||||
'dialog:beforecreate': function dialogBeforecreate(event, dialog, $element, settings) {
|
||||
if ($element.is('#drupal-off-canvas')) {
|
||||
$('body .outside-in-active-editable').removeClass('outside-in-active-editable');
|
||||
var $activeElement = $('#' + settings.outsideInActiveEditableId);
|
||||
$('body .settings-tray-active-editable').removeClass('settings-tray-active-editable');
|
||||
var $activeElement = $('#' + settings.settingsTrayActiveEditableId);
|
||||
if ($activeElement.length) {
|
||||
$activeElement.addClass('outside-in-active-editable');
|
||||
$activeElement.addClass('settings-tray-active-editable');
|
||||
}
|
||||
}
|
||||
},
|
||||
'dialog:beforeclose': function dialogBeforeclose(event, dialog, $element) {
|
||||
if ($element.is('#drupal-off-canvas')) {
|
||||
$('body .outside-in-active-editable').removeClass('outside-in-active-editable');
|
||||
$('body .settings-tray-active-editable').removeClass('settings-tray-active-editable');
|
||||
}
|
||||
}
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @defgroup outside_in Settings Tray API
|
||||
* @defgroup settings_tray Settings Tray API
|
||||
* @{
|
||||
* Settings Tray API
|
||||
*
|
||||
|
@ -17,8 +17,8 @@
|
|||
* - limits the form items displayed in the Settings Tray to only items that
|
||||
* affect the content of the rendered block
|
||||
* - adds additional form items to edit configuration that is rendered by the
|
||||
* block. See \Drupal\outside_in\Form\SystemBrandingOffCanvasForm which adds
|
||||
* site name and slogan configuration.
|
||||
* block. See \Drupal\settings_tray\Form\SystemBrandingOffCanvasForm which
|
||||
* adds site name and slogan configuration.
|
||||
*
|
||||
* These can be used to provide a better experience, so that the Settings Tray
|
||||
* only displays what the user will expect to change when editing the block.
|
||||
|
@ -54,8 +54,8 @@
|
|||
* Therefore, the entire Settings Tray API is just this annotation: it controls
|
||||
* what the Settings Tray does for a given block.
|
||||
*
|
||||
* @see outside_in_block_alter()
|
||||
* @see \Drupal\Tests\outside_in\Functional\OutsideInBlockTest::testPossibleAnnotations()
|
||||
* @see settings_tray_block_alter()
|
||||
* @see \Drupal\Tests\settings_tray\Functional\SettingsTrayBlockTest::testPossibleAnnotations()
|
||||
*
|
||||
* @}
|
||||
*/
|
|
@ -10,7 +10,7 @@ use Drupal\Core\Cache\Cache;
|
|||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function outside_in_install() {
|
||||
function settings_tray_install() {
|
||||
// This module affects the rendering of blocks and of the page.
|
||||
// @todo Remove in https://www.drupal.org/node/2783791.
|
||||
Cache::invalidateTags(['rendered']);
|
|
@ -1,17 +1,17 @@
|
|||
drupal.outside_in:
|
||||
drupal.settings_tray:
|
||||
version: VERSION
|
||||
js:
|
||||
js/outside_in.js: {}
|
||||
js/settings_tray.js: {}
|
||||
css:
|
||||
component:
|
||||
css/outside_in.module.css: {}
|
||||
css/outside_in.motion.css: {}
|
||||
css/outside_in.toolbar.css: {}
|
||||
css/settings_tray.module.css: {}
|
||||
css/settings_tray.motion.css: {}
|
||||
css/settings_tray.toolbar.css: {}
|
||||
theme:
|
||||
# @todo Set the group higher than CSS_AGGREGATE_THEME so that it overrides
|
||||
# both jQuery UI and Classy's dialog.css, remove in
|
||||
# https://www.drupal.org/node/1945262.
|
||||
css/outside_in.theme.css: { group: 200 }
|
||||
css/settings_tray.theme.css: { group: 200 }
|
||||
dependencies:
|
||||
- core/jquery
|
||||
- core/drupal
|
|
@ -1,4 +1,4 @@
|
|||
outside_in.block_configure:
|
||||
settings_tray.block_configure:
|
||||
title: 'Quick edit'
|
||||
route_name: 'entity.block.off_canvas_form'
|
||||
group: 'block'
|
||||
|
@ -7,4 +7,4 @@ outside_in.block_configure:
|
|||
class: ['use-ajax']
|
||||
data-dialog-type: dialog
|
||||
data-dialog-renderer: off_canvas
|
||||
data-outside-in-edit: true
|
||||
data-settings-tray-edit: true
|
|
@ -7,18 +7,18 @@
|
|||
|
||||
use Drupal\Core\Asset\AttachedAssetsInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\outside_in\Block\BlockEntityOffCanvasForm;
|
||||
use Drupal\outside_in\Form\SystemBrandingOffCanvasForm;
|
||||
use Drupal\outside_in\Form\SystemMenuOffCanvasForm;
|
||||
use Drupal\settings_tray\Block\BlockEntityOffCanvasForm;
|
||||
use Drupal\settings_tray\Form\SystemBrandingOffCanvasForm;
|
||||
use Drupal\settings_tray\Form\SystemMenuOffCanvasForm;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function outside_in_help($route_name, RouteMatchInterface $route_match) {
|
||||
function settings_tray_help($route_name, RouteMatchInterface $route_match) {
|
||||
switch ($route_name) {
|
||||
case 'help.page.outside_in':
|
||||
case 'help.page.settings_tray':
|
||||
$output = '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Settings Tray module provides an \'edit mode\' in which clicking on a block opens a slide-out tray which allows configuration to be altered without leaving the page.For more information, see the <a href=":outside-in-documentation">online documentation for the Settings Tray module</a>.', [':outside-in-documentation' => 'https://www.drupal.org/documentation/modules/outside_in']) . '</p>';
|
||||
$output .= '<p>' . t('The Settings Tray module provides an \'edit mode\' in which clicking on a block opens a slide-out tray which allows configuration to be altered without leaving the page.For more information, see the <a href=":settings-tray-documentation">online documentation for the Settings Tray module</a>.', [':settings-tray-documentation' => 'https://www.drupal.org/documentation/modules/settings_tray']) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Editing blocks on the same page in the slide-out tray') . '</dt>';
|
||||
|
@ -32,30 +32,30 @@ function outside_in_help($route_name, RouteMatchInterface $route_match) {
|
|||
*
|
||||
* Change Configure Blocks into off_canvas links.
|
||||
*/
|
||||
function outside_in_contextual_links_view_alter(&$element, $items) {
|
||||
if (isset($element['#links']['outside-inblock-configure'])) {
|
||||
// Place outside_in link first.
|
||||
$outside_in_link = $element['#links']['outside-inblock-configure'];
|
||||
unset($element['#links']['outside-inblock-configure']);
|
||||
$element['#links'] = ['outside-inblock-configure' => $outside_in_link] + $element['#links'];
|
||||
function settings_tray_contextual_links_view_alter(&$element, $items) {
|
||||
if (isset($element['#links']['settings-trayblock-configure'])) {
|
||||
// Place settings_tray link first.
|
||||
$settings_tray_link = $element['#links']['settings-trayblock-configure'];
|
||||
unset($element['#links']['settings-trayblock-configure']);
|
||||
$element['#links'] = ['settings-trayblock-configure' => $settings_tray_link] + $element['#links'];
|
||||
|
||||
// If this is content block change title to avoid duplicate "Quick Edit".
|
||||
if (isset($element['#links']['block-contentblock-edit'])) {
|
||||
$element['#links']['outside-inblock-configure']['title'] = t('Quick edit settings');
|
||||
$element['#links']['settings-trayblock-configure']['title'] = t('Quick edit settings');
|
||||
}
|
||||
|
||||
$element['#attached']['library'][] = 'outside_in/drupal.off_canvas';
|
||||
$element['#attached']['library'][] = 'settings_tray/drupal.off_canvas';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_block_view_alter().
|
||||
*/
|
||||
function outside_in_block_view_alter(array &$build) {
|
||||
function settings_tray_block_view_alter(array &$build) {
|
||||
// Force a new 'data-contextual-id' attribute on blocks when this module is
|
||||
// enabled so as not to reuse stale data cached client-side.
|
||||
// @todo Remove when https://www.drupal.org/node/2773591 is fixed.
|
||||
$build['#contextual_links']['outside_in'] = [
|
||||
$build['#contextual_links']['settings_tray'] = [
|
||||
'route_parameters' => [],
|
||||
];
|
||||
}
|
||||
|
@ -63,18 +63,18 @@ function outside_in_block_view_alter(array &$build) {
|
|||
/**
|
||||
* Implements hook_element_info_alter().
|
||||
*/
|
||||
function outside_in_element_info_alter(&$type) {
|
||||
function settings_tray_element_info_alter(&$type) {
|
||||
if (isset($type['page'])) {
|
||||
$type['page']['#theme_wrappers']['outside_in_page_wrapper'] = ['#weight' => -1000];
|
||||
$type['page']['#theme_wrappers']['settings_tray_page_wrapper'] = ['#weight' => -1000];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function outside_in_theme() {
|
||||
function settings_tray_theme() {
|
||||
return [
|
||||
'outside_in_page_wrapper' => [
|
||||
'settings_tray_page_wrapper' => [
|
||||
'variables' => ['children' => NULL],
|
||||
],
|
||||
];
|
||||
|
@ -83,7 +83,7 @@ function outside_in_theme() {
|
|||
/**
|
||||
* Implements hook_entity_type_build().
|
||||
*/
|
||||
function outside_in_entity_type_build(array &$entity_types) {
|
||||
function settings_tray_entity_type_build(array &$entity_types) {
|
||||
/* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
|
||||
$entity_types['block']
|
||||
->setFormClass('off_canvas', BlockEntityOffCanvasForm::class)
|
||||
|
@ -93,24 +93,24 @@ function outside_in_entity_type_build(array &$entity_types) {
|
|||
/**
|
||||
* Implements hook_preprocess_HOOK() for block templates.
|
||||
*/
|
||||
function outside_in_preprocess_block(&$variables) {
|
||||
function settings_tray_preprocess_block(&$variables) {
|
||||
// Only blocks that have an settings_tray form will have a "Quick Edit" link.
|
||||
// We could wait for the contextual links to be initialized on the client
|
||||
// side, and then add the class and data- attribute below there (via
|
||||
// JavaScript). But that would mean that it would be impossible to show
|
||||
// Settings Tray's clickable regions immediately when the page loads. When
|
||||
// latency is high, this will cause flicker.
|
||||
// @see \Drupal\outside_in\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
/** @var \Drupal\outside_in\Access\BlockPluginHasSettingsTrayFormAccessCheck $access_checker */
|
||||
$access_checker = \Drupal::service('access_check.outside_in.block.settings_tray_form');
|
||||
// @see \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
/** @var \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck $access_checker */
|
||||
$access_checker = \Drupal::service('access_check.settings_tray.block.settings_tray_form');
|
||||
/** @var \Drupal\Core\Block\BlockManagerInterface $block_plugin_manager */
|
||||
$block_plugin_manager = \Drupal::service('plugin.manager.block');
|
||||
/** @var \Drupal\Core\Block\BlockPluginInterface $block_plugin */
|
||||
$block_plugin = $block_plugin_manager->createInstance($variables['plugin_id']);
|
||||
if ($access_checker->accessBlockPlugin($block_plugin)->isAllowed()) {
|
||||
// Add class and attributes to all blocks to allow Javascript to target.
|
||||
$variables['attributes']['class'][] = 'outside-in-editable';
|
||||
$variables['attributes']['data-drupal-outsidein'] = 'editable';
|
||||
$variables['attributes']['class'][] = 'settings-tray-editable';
|
||||
$variables['attributes']['data-drupal-settingstray'] = 'editable';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,12 +125,12 @@ function outside_in_preprocess_block(&$variables) {
|
|||
*
|
||||
* @see contextual_toolbar()
|
||||
*/
|
||||
function outside_in_toolbar_alter(&$items) {
|
||||
function settings_tray_toolbar_alter(&$items) {
|
||||
$items['contextual']['#cache']['contexts'][] = 'user.permissions';
|
||||
if (isset($items['contextual']['tab']) && \Drupal::currentUser()->hasPermission('administer blocks')) {
|
||||
$items['contextual']['#weight'] = -1000;
|
||||
$items['contextual']['#attached']['library'][] = 'outside_in/drupal.outside_in';
|
||||
$items['contextual']['tab']['#attributes']['data-drupal-outsidein'] = 'toggle';
|
||||
$items['contextual']['#attached']['library'][] = 'settings_tray/drupal.settings_tray';
|
||||
$items['contextual']['tab']['#attributes']['data-drupal-settingstray'] = 'toggle';
|
||||
|
||||
// Set a class on items to mark whether they should be active in edit mode.
|
||||
// @todo Create a dynamic method for modules to set their own items.
|
||||
|
@ -149,9 +149,9 @@ function outside_in_toolbar_alter(&$items) {
|
|||
*
|
||||
* Ensures every block plugin definition has an 'settings_tray' form specified.
|
||||
*
|
||||
* @see \Drupal\outside_in\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
* @see \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
*/
|
||||
function outside_in_block_alter(&$definitions) {
|
||||
function settings_tray_block_alter(&$definitions) {
|
||||
foreach ($definitions as &$definition) {
|
||||
// If a block plugin already defines its own 'settings_tray' form, use that
|
||||
// form instead of specifying one here.
|
||||
|
@ -201,10 +201,10 @@ function outside_in_block_alter(&$definitions) {
|
|||
/**
|
||||
* Implements hook_css_alter().
|
||||
*/
|
||||
function outside_in_css_alter(&$css, AttachedAssetsInterface $assets) {
|
||||
function settings_tray_css_alter(&$css, AttachedAssetsInterface $assets) {
|
||||
// @todo Remove once conditional ordering is introduced in
|
||||
// https://www.drupal.org/node/1945262.
|
||||
$path = drupal_get_path('module', 'outside_in') . '/css/outside_in.theme.css';
|
||||
$path = drupal_get_path('module', 'settings_tray') . '/css/settings_tray.theme.css';
|
||||
if (isset($css[$path])) {
|
||||
// Use 200 to come after CSS_AGGREGATE_THEME.
|
||||
$css[$path]['group'] = 200;
|
|
@ -2,7 +2,7 @@ entity.block.off_canvas_form:
|
|||
path: '/admin/structure/block/manage/{block}/off-canvas'
|
||||
defaults:
|
||||
_entity_form: 'block.off_canvas'
|
||||
_title_callback: '\Drupal\outside_in\Block\BlockEntityOffCanvasForm::title'
|
||||
_title_callback: '\Drupal\settings_tray\Block\BlockEntityOffCanvasForm::title'
|
||||
requirements:
|
||||
_permission: 'administer blocks'
|
||||
_access_block_plugin_has_settings_tray_form: 'TRUE'
|
|
@ -1,11 +1,11 @@
|
|||
services:
|
||||
main_content_renderer.off_canvas:
|
||||
class: Drupal\outside_in\Render\MainContent\OffCanvasRenderer
|
||||
class: Drupal\settings_tray\Render\MainContent\OffCanvasRenderer
|
||||
arguments: ['@title_resolver', '@renderer']
|
||||
tags:
|
||||
- { name: render.main_content_renderer, format: drupal_dialog.off_canvas }
|
||||
|
||||
access_check.outside_in.block.settings_tray_form:
|
||||
class: Drupal\outside_in\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
access_check.settings_tray.block.settings_tray_form:
|
||||
class: Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
tags:
|
||||
- { name: access_check, applies_to: _access_block_plugin_has_settings_tray_form }
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Access;
|
||||
namespace Drupal\settings_tray\Access;
|
||||
|
||||
use Drupal\block\BlockInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
@ -39,7 +39,7 @@ class BlockPluginHasSettingsTrayFormAccessCheck implements AccessInterface {
|
|||
* @return \Drupal\Core\Access\AccessResultInterface
|
||||
* The access result.
|
||||
*
|
||||
* @see outside_in_preprocess_block()
|
||||
* @see settings_tray_preprocess_block()
|
||||
*/
|
||||
public function accessBlockPlugin(BlockPluginInterface $block_plugin) {
|
||||
return AccessResult::allowedIf($block_plugin instanceof PluginWithFormsInterface && $block_plugin->hasFormClass('settings_tray'));
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Ajax;
|
||||
namespace Drupal\settings_tray\Ajax;
|
||||
|
||||
use Drupal\Core\Ajax\OpenDialogCommand;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Block;
|
||||
namespace Drupal\settings_tray\Block;
|
||||
|
||||
use Drupal\block\BlockForm;
|
||||
use Drupal\block\BlockInterface;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Form;
|
||||
namespace Drupal\settings_tray\Form;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
|
@ -11,7 +11,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
/**
|
||||
* The off-canvas form handler for the SystemBrandingBlock.
|
||||
*
|
||||
* @see outside_in_block_alter()
|
||||
* @see settings_tray_block_alter()
|
||||
*
|
||||
* @internal
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Form;
|
||||
namespace Drupal\settings_tray\Form;
|
||||
|
||||
use Drupal\Component\Plugin\PluginInspectionInterface;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
|
@ -18,7 +18,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
/**
|
||||
* The off-canvas form handler for the SystemMenuBlock.
|
||||
*
|
||||
* @see outside_in_block_alter()
|
||||
* @see settings_tray_block_alter()
|
||||
*
|
||||
* @internal
|
||||
*/
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Render\MainContent;
|
||||
namespace Drupal\settings_tray\Render\MainContent;
|
||||
|
||||
use Drupal\Core\Ajax\AjaxResponse;
|
||||
use Drupal\Core\Controller\TitleResolverInterface;
|
||||
use Drupal\Core\Render\MainContent\DialogRenderer;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\outside_in\Ajax\OpenOffCanvasDialogCommand;
|
||||
use Drupal\settings_tray\Ajax\OpenOffCanvasDialogCommand;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ class OffCanvasRenderer extends DialogRenderer {
|
|||
$content = $this->renderer->renderRoot($main_content);
|
||||
// Attach the library necessary for using the OpenOffCanvasDialogCommand and
|
||||
// set the attachments for this Ajax response.
|
||||
$main_content['#attached']['library'][] = 'outside_in/drupal.off_canvas';
|
||||
$main_content['#attached']['library'][] = 'settings_tray/drupal.off_canvas';
|
||||
$response->setAttachments($main_content['#attached']);
|
||||
|
||||
// If the main content doesn't provide a title, use the title resolver.
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in\Tests\Ajax;
|
||||
namespace Drupal\settings_tray\Tests\Ajax;
|
||||
|
||||
use Drupal\ajax_test\Controller\AjaxTestController;
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
|
@ -9,7 +9,7 @@ use Drupal\system\Tests\Ajax\AjaxTestBase;
|
|||
/**
|
||||
* Performs tests on opening and manipulating dialogs via AJAX commands.
|
||||
*
|
||||
* @group outside_in
|
||||
* @group settings_tray
|
||||
*/
|
||||
class OffCanvasDialogTest extends AjaxTestBase {
|
||||
|
||||
|
@ -18,7 +18,7 @@ class OffCanvasDialogTest extends AjaxTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['outside_in'];
|
||||
public static $modules = ['settings_tray'];
|
||||
|
||||
/**
|
||||
* Test sending AJAX requests to open and manipulate off-canvas dialog.
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* For consistent wrapping to {{ page }} render in all themes. The
|
||||
* "data-off-canvas-main-canvas" attribute is required by the off-canvas dialog.
|
||||
* This is used by the outside_in/drupal.off_canvas library to select the
|
||||
* This is used by the settings_tray/drupal.off_canvas library to select the
|
||||
* "main canvas" page element as opposed to the "off canvas" which is the tray
|
||||
* itself. The "main canvas" element must be resized according to the width of
|
||||
* the "off canvas" tray so that no portion of the "main canvas" is obstructed
|
|
@ -6,4 +6,4 @@ version: VERSION
|
|||
core: 8.x
|
||||
dependencies:
|
||||
- block
|
||||
- outside_in
|
||||
- settings_tray
|
|
@ -55,7 +55,7 @@ class TestController {
|
|||
],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'outside_in/drupal.outside_in',
|
||||
'settings_tray/drupal.settings_tray',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -73,7 +73,7 @@ class TestController {
|
|||
],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'outside_in/drupal.outside_in',
|
||||
'settings_tray/drupal.settings_tray',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -88,7 +88,7 @@ class TestController {
|
|||
],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'outside_in/drupal.outside_in',
|
||||
'settings_tray/drupal.settings_tray',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -131,7 +131,7 @@ class TestController {
|
|||
],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'outside_in/drupal.outside_in',
|
||||
'settings_tray/drupal.settings_tray',
|
||||
],
|
||||
],
|
||||
];
|
|
@ -6,4 +6,4 @@ version: VERSION
|
|||
core: 8.x
|
||||
dependencies:
|
||||
- block
|
||||
- outside_in
|
||||
- settings_tray
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in_test\Form;
|
||||
namespace Drupal\settings_tray_test\Form;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\PluginFormBase;
|
||||
|
||||
/**
|
||||
* @see \Drupal\outside_in_test\Plugin\Block\SettingsTrayFormAnnotationIsClassBlock
|
||||
* @see \Drupal\settings_tray_test\Plugin\Block\SettingsTrayFormAnnotationIsClassBlock
|
||||
*/
|
||||
class SettingsTrayFormAnnotationIsClassBlockForm extends PluginFormBase {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in_test\Plugin\Block;
|
||||
namespace Drupal\settings_tray_test\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
|
||||
|
@ -8,10 +8,10 @@ use Drupal\Core\Block\BlockBase;
|
|||
* Block that explicitly provides a "settings_tray" form class.
|
||||
*
|
||||
* @Block(
|
||||
* id = "outside_in_test_class",
|
||||
* id = "settings_tray_test_class",
|
||||
* admin_label = "Settings Tray test block: forms[settings_tray]=class",
|
||||
* forms = {
|
||||
* "settings_tray" = "\Drupal\outside_in_test\Form\SettingsTrayFormAnnotationIsClassBlockForm",
|
||||
* "settings_tray" = "\Drupal\settings_tray_test\Form\SettingsTrayFormAnnotationIsClassBlockForm",
|
||||
* },
|
||||
* )
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in_test\Plugin\Block;
|
||||
namespace Drupal\settings_tray_test\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
|
||||
|
@ -8,7 +8,7 @@ use Drupal\Core\Block\BlockBase;
|
|||
* Block that explicitly provides no "settings_tray" form, thus opting out.
|
||||
*
|
||||
* @Block(
|
||||
* id = "outside_in_test_false",
|
||||
* id = "settings_tray_test_false",
|
||||
* admin_label = "Settings Tray test block: forms[settings_tray]=FALSE",
|
||||
* forms = {
|
||||
* "settings_tray" = FALSE,
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in_test\Plugin\Block;
|
||||
namespace Drupal\settings_tray_test\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
|
||||
|
@ -8,7 +8,7 @@ use Drupal\Core\Block\BlockBase;
|
|||
* Block that does nothing explicit for Settings Tray.
|
||||
*
|
||||
* @Block(
|
||||
* id = "outside_in_test_none",
|
||||
* id = "settings_tray_test_none",
|
||||
* admin_label = "Settings Tray test block: forms[settings_tray] is not specified",
|
||||
* )
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\outside_in_test\Plugin\Block;
|
||||
namespace Drupal\settings_tray_test\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
@ -9,7 +9,7 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
* Provides a 'Block with validation error' test block.
|
||||
*
|
||||
* @Block(
|
||||
* id = "outside_in_test_validation",
|
||||
* id = "settings_tray_test_validation",
|
||||
* admin_label = @Translation("Block with validation error")
|
||||
* )
|
||||
*/
|
|
@ -1,5 +1,5 @@
|
|||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode a,
|
||||
.dialog-off-canvas__main-canvas.js-outside-in-edit-mode input {
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode a,
|
||||
.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode input {
|
||||
pointer-events: inherit !important;
|
||||
}
|
||||
/**
|
|
@ -5,4 +5,4 @@ package: Testing
|
|||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- outside_in
|
||||
- settings_tray
|
|
@ -10,7 +10,7 @@
|
|||
/**
|
||||
* Implements hook_page_attachments().
|
||||
*/
|
||||
function outside_in_test_css_page_attachments(array &$attachments) {
|
||||
function settings_tray_test_css_page_attachments(array &$attachments) {
|
||||
// Unconditionally attach an asset to the page.
|
||||
$attachments['#attached']['library'][] = 'outside_in_test_css/drupal.css_fix';
|
||||
$attachments['#attached']['library'][] = 'settings_tray_test_css/drupal.css_fix';
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\outside_in\Functional;
|
||||
namespace Drupal\Tests\settings_tray\Functional;
|
||||
|
||||
use Drupal\block\Entity\Block;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
@ -8,16 +8,16 @@ use Drupal\Tests\BrowserTestBase;
|
|||
/**
|
||||
* Tests opening and saving block forms in the off-canvas dialog.
|
||||
*
|
||||
* @group outside_in
|
||||
* @group settings_tray
|
||||
*/
|
||||
class OutsideInTest extends BrowserTestBase {
|
||||
class SettingsTrayTest extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = [
|
||||
'outside_in',
|
||||
'outside_in_test',
|
||||
'settings_tray',
|
||||
'settings_tray_test',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -40,16 +40,16 @@ class OutsideInTest extends BrowserTestBase {
|
|||
* that support Settings Tray (the "class" and "none" cases) do work
|
||||
* correctly.
|
||||
*
|
||||
* @see OutsideInBlockFormTest::testBlocks()
|
||||
* @see SettingsTrayBlockFormTest::testBlocks()
|
||||
*/
|
||||
public function testPossibleAnnotations() {
|
||||
$test_block_plugin_ids = [
|
||||
// Block that explicitly provides an "settings_tray" form class.
|
||||
'outside_in_test_class',
|
||||
'settings_tray_test_class',
|
||||
// Block that explicitly provides no "settings_tray" form, thus opting out.
|
||||
'outside_in_test_false',
|
||||
'settings_tray_test_false',
|
||||
// Block that does nothing explicit for Settings Tray.
|
||||
'outside_in_test_none',
|
||||
'settings_tray_test_none',
|
||||
];
|
||||
|
||||
$placed_blocks = [];
|
||||
|
@ -65,14 +65,14 @@ class OutsideInTest extends BrowserTestBase {
|
|||
// All blocks are rendered.
|
||||
$web_assert->elementExists('css', $block_selector);
|
||||
|
||||
// All blocks except 'outside_in_test_false' are editable. For more
|
||||
// All blocks except 'settings_tray_test_false' are editable. For more
|
||||
// detailed test coverage, which requires JS execution, see
|
||||
// \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::testBlocks().
|
||||
if ($plugin_id === 'outside_in_test_false') {
|
||||
$web_assert->elementNotExists('css', "{$block_selector}[data-drupal-outsidein=\"editable\"]");
|
||||
// \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::testBlocks().
|
||||
if ($plugin_id === 'settings_tray_test_false') {
|
||||
$web_assert->elementNotExists('css', "{$block_selector}[data-drupal-settingstray=\"editable\"]");
|
||||
}
|
||||
else {
|
||||
$web_assert->elementExists('css', "{$block_selector}[data-drupal-outsidein=\"editable\"]");
|
||||
$web_assert->elementExists('css', "{$block_selector}[data-drupal-settingstray=\"editable\"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class OutsideInTest extends BrowserTestBase {
|
|||
$web_assert = $this->assertSession();
|
||||
|
||||
$non_excluded_block = $this->placeBlock('system_powered_by_block');
|
||||
$excluded_block_plugin_ids = ['page_title_block', 'system_main_block', 'outside_in_test_false'];
|
||||
$excluded_block_plugin_ids = ['page_title_block', 'system_main_block', 'settings_tray_test_false'];
|
||||
$block_selectors = [];
|
||||
// Place blocks that should be excluded.
|
||||
foreach ($excluded_block_plugin_ids as $excluded_block_plugin_id) {
|
||||
|
@ -94,15 +94,15 @@ class OutsideInTest extends BrowserTestBase {
|
|||
$this->drupalGet('');
|
||||
// Assert that block has been marked as "editable" and contextual that
|
||||
// should exist does.
|
||||
$web_assert->elementExists('css', $this->getBlockSelector($non_excluded_block) . "[data-drupal-outsidein=\"editable\"]");
|
||||
$web_assert->elementExists('css', $this->getBlockSelector($non_excluded_block) . "[data-drupal-settingstray=\"editable\"]");
|
||||
// Assert that each block that has a "forms[settings_tray] = FALSE" annotation:
|
||||
// - is still rendered on the page
|
||||
// - but is not marked as "editable" by outside_in_preprocess_block()
|
||||
// - but is not marked as "editable" by settings_tray_preprocess_block()
|
||||
// - and does not have the Settings Tray contextual link.
|
||||
foreach ($block_selectors as $block_selector) {
|
||||
$web_assert->elementExists('css', $block_selector);
|
||||
$web_assert->elementNotExists('css', "{$block_selector}[data-drupal-outsidein=\"editable\"]");
|
||||
$web_assert->elementNotExists('css', "$block_selector [data-outside-in-edit]");
|
||||
$web_assert->elementNotExists('css', "{$block_selector}[data-drupal-settingstray=\"editable\"]");
|
||||
$web_assert->elementNotExists('css', "$block_selector [data-settings-tray-edit]");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\outside_in\FunctionalJavascript;
|
||||
namespace Drupal\Tests\settings_tray\FunctionalJavascript;
|
||||
|
||||
/**
|
||||
* Tests the off-canvas dialog functionality.
|
||||
*
|
||||
* @group outside_in
|
||||
* @group settings_tray
|
||||
*/
|
||||
class OffCanvasTest extends OutsideInJavascriptTestBase {
|
||||
class OffCanvasTest extends SettingsTrayJavascriptTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -16,7 +16,7 @@ class OffCanvasTest extends OutsideInJavascriptTestBase {
|
|||
'block',
|
||||
'system',
|
||||
'toolbar',
|
||||
'outside_in',
|
||||
'settings_tray',
|
||||
'off_canvas_test',
|
||||
];
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\outside_in\FunctionalJavascript;
|
||||
namespace Drupal\Tests\settings_tray\FunctionalJavascript;
|
||||
|
||||
use Drupal\block\Entity\Block;
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\outside_in_test\Plugin\Block\SettingsTrayFormAnnotationIsClassBlock;
|
||||
use Drupal\outside_in_test\Plugin\Block\SettingsTrayFormAnnotationNoneBlock;
|
||||
use Drupal\settings_tray_test\Plugin\Block\SettingsTrayFormAnnotationIsClassBlock;
|
||||
use Drupal\settings_tray_test\Plugin\Block\SettingsTrayFormAnnotationNoneBlock;
|
||||
use Drupal\user\Entity\Role;
|
||||
|
||||
/**
|
||||
* Testing opening and saving block forms in the off-canvas dialog.
|
||||
*
|
||||
* @group outside_in
|
||||
* @group settings_tray
|
||||
*/
|
||||
class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
||||
class SettingsTrayBlockFormTest extends SettingsTrayJavascriptTestBase {
|
||||
|
||||
const TOOLBAR_EDIT_LINK_SELECTOR = '#toolbar-bar div.contextual-toolbar-tab button';
|
||||
|
||||
|
@ -30,15 +30,15 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
'breakpoint',
|
||||
'toolbar',
|
||||
'contextual',
|
||||
'outside_in',
|
||||
'settings_tray',
|
||||
'quickedit',
|
||||
'search',
|
||||
'block_content',
|
||||
'outside_in_test',
|
||||
'settings_tray_test',
|
||||
// Add test module to override CSS pointer-events properties because they
|
||||
// cause test failures.
|
||||
'outside_in_test_css',
|
||||
'outside_in_test',
|
||||
'settings_tray_test_css',
|
||||
'settings_tray_test',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -114,7 +114,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
$page->fillField('settings[site_information][site_name]', $new_page_text);
|
||||
break;
|
||||
|
||||
case 'outside_in_test_class':
|
||||
case 'settings_tray_test_class':
|
||||
$web_assert->elementExists('css', '[data-drupal-selector="edit-settings-some-setting"]');
|
||||
break;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
// suppressed.
|
||||
$this->openBlockForm("$block_selector {$element_selector}", $block_selector);
|
||||
$web_assert->elementTextContains('css', '.contextual-toolbar-tab button', 'Editing');
|
||||
$web_assert->elementAttributeContains('css', '.dialog-off-canvas__main-canvas', 'class', 'js-outside-in-edit-mode');
|
||||
$web_assert->elementAttributeContains('css', '.dialog-off-canvas__main-canvas', 'class', 'js-settings-tray-edit-mode');
|
||||
// Simulate press the Escape key.
|
||||
$this->getSession()->executeScript('jQuery("body").trigger(jQuery.Event("keyup", { keyCode: 27 }));');
|
||||
$this->waitForOffCanvasToClose();
|
||||
|
@ -148,7 +148,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
$this->assertEditModeDisabled();
|
||||
$web_assert->elementTextContains('css', '#drupal-live-announce', 'Exited edit mode.');
|
||||
$web_assert->elementTextNotContains('css', '.contextual-toolbar-tab button', 'Editing');
|
||||
$web_assert->elementAttributeNotContains('css', '.dialog-off-canvas__main-canvas', 'class', 'js-outside-in-edit-mode');
|
||||
$web_assert->elementAttributeNotContains('css', '.dialog-off-canvas__main-canvas', 'class', 'js-settings-tray-edit-mode');
|
||||
// Delete the block that was placed for the current theme.
|
||||
$block->delete();
|
||||
}
|
||||
|
@ -184,9 +184,9 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
'toolbar_item' => NULL,
|
||||
],
|
||||
// This is the functional JS test coverage accompanying
|
||||
// \Drupal\Tests\outside_in\Functional\OutsideInTest::testPossibleAnnotations().
|
||||
// \Drupal\Tests\settings_tray\Functional\SettingsTrayTest::testPossibleAnnotations().
|
||||
SettingsTrayFormAnnotationIsClassBlock::class => [
|
||||
'block_plugin' => 'outside_in_test_class',
|
||||
'block_plugin' => 'settings_tray_test_class',
|
||||
'new_page_text' => NULL,
|
||||
'element_selector' => 'span',
|
||||
'label_selector' => NULL,
|
||||
|
@ -194,9 +194,9 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
'toolbar_item' => NULL,
|
||||
],
|
||||
// This is the functional JS test coverage accompanying
|
||||
// \Drupal\Tests\outside_in\Functional\OutsideInTest::testPossibleAnnotations().
|
||||
// \Drupal\Tests\settings_tray\Functional\SettingsTrayTest::testPossibleAnnotations().
|
||||
SettingsTrayFormAnnotationNoneBlock::class => [
|
||||
'block_plugin' => 'outside_in_test_none',
|
||||
'block_plugin' => 'settings_tray_test_none',
|
||||
'new_page_text' => NULL,
|
||||
'element_selector' => 'span',
|
||||
'label_selector' => NULL,
|
||||
|
@ -267,7 +267,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
$this->assertNotEmpty($contextual_link);
|
||||
// When page first loads Edit Mode is not triggered until first contextual
|
||||
// link is added.
|
||||
$this->assertElementVisibleAfterWait('css', '.dialog-off-canvas__main-canvas.js-outside-in-edit-mode');
|
||||
$this->assertElementVisibleAfterWait('css', '.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode');
|
||||
// Ensure that all other Ajax activity is completed.
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
$this->click($block_selector);
|
||||
|
@ -403,8 +403,8 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
$web_assert->elementNotExists('css', '.contextual .trigger.visually-hidden');
|
||||
// The toolbar edit button should read "Editing".
|
||||
$web_assert->elementContains('css', static::TOOLBAR_EDIT_LINK_SELECTOR, 'Editing');
|
||||
// The main canvas element should have the "js-outside-in-edit-mode" class.
|
||||
$web_assert->elementExists('css', '.dialog-off-canvas__main-canvas.js-outside-in-edit-mode');
|
||||
// The main canvas element should have the "js-settings-tray-edit-mode" class.
|
||||
$web_assert->elementExists('css', '.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -418,9 +418,9 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
$web_assert->elementNotExists('css', '.contextual .trigger:not(.visually-hidden)');
|
||||
// The toolbar edit button should read "Edit".
|
||||
$web_assert->elementContains('css', static::TOOLBAR_EDIT_LINK_SELECTOR, 'Edit');
|
||||
// The main canvas element should NOT have the "js-outside-in-edit-mode"
|
||||
// The main canvas element should NOT have the "js-settings-tray-edit-mode"
|
||||
// class.
|
||||
$web_assert->elementNotExists('css', '.dialog-off-canvas__main-canvas.js-outside-in-edit-mode');
|
||||
$web_assert->elementNotExists('css', '.dialog-off-canvas__main-canvas.js-settings-tray-edit-mode');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -493,7 +493,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
* Tests that contextual links in custom blocks are changed.
|
||||
*
|
||||
* "Quick edit" is quickedit.module link.
|
||||
* "Quick edit settings" is outside_in.module link.
|
||||
* "Quick edit settings" is settings_tray.module link.
|
||||
*/
|
||||
public function testCustomBlockLinks() {
|
||||
$this->drupalGet('user');
|
||||
|
@ -541,14 +541,14 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
$web_assert = $this->assertSession();
|
||||
foreach ($this->getTestThemes() as $theme) {
|
||||
$this->enableTheme($theme);
|
||||
$block = $this->placeBlock('outside_in_test_validation');
|
||||
$block = $this->placeBlock('settings_tray_test_validation');
|
||||
$this->drupalGet('user');
|
||||
$this->enableEditMode();
|
||||
$this->openBlockForm($this->getBlockSelector($block));
|
||||
$page->pressButton('Save Block with validation error');
|
||||
$web_assert->assertWaitOnAjaxRequest();
|
||||
// The outside_in_test_validation test plugin form always has a validation
|
||||
// error.
|
||||
// The settings_tray_test_validation test plugin form always has a
|
||||
// validation error.
|
||||
$web_assert->elementContains('css', '#drupal-off-canvas', 'Sorry system error. Please save again');
|
||||
$this->disableEditMode();
|
||||
$block->delete();
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\outside_in\FunctionalJavascript;
|
||||
namespace Drupal\Tests\settings_tray\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
|
||||
/**
|
||||
* Base class contains common test functionality for the Settings Tray module.
|
||||
*/
|
||||
abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
|
||||
abstract class SettingsTrayJavascriptTestBase extends JavascriptTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\outside_in\Unit\Access;
|
||||
namespace Drupal\Tests\settings_tray\Unit\Access;
|
||||
|
||||
use Drupal\block\BlockInterface;
|
||||
use Drupal\Core\Access\AccessResultAllowed;
|
||||
|
@ -8,13 +8,13 @@ use Drupal\Core\Access\AccessResultInterface;
|
|||
use Drupal\Core\Access\AccessResultNeutral;
|
||||
use Drupal\Core\Block\BlockPluginInterface;
|
||||
use Drupal\Core\Plugin\PluginWithFormsInterface;
|
||||
use Drupal\outside_in\Access\BlockPluginHasSettingsTrayFormAccessCheck;
|
||||
use Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
use Prophecy\Argument;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\outside_in\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
* @group outside_in
|
||||
* @coversDefaultClass \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
|
||||
* @group settings_tray
|
||||
*/
|
||||
class BlockPluginHasSettingsTrayFormAccessCheckTest extends UnitTestCase {
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\outside_in\Unit\Ajax;
|
||||
namespace Drupal\Tests\settings_tray\Unit\Ajax;
|
||||
|
||||
use Drupal\outside_in\Ajax\OpenOffCanvasDialogCommand;
|
||||
use Drupal\settings_tray\Ajax\OpenOffCanvasDialogCommand;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\outside_in\Ajax\OpenOffCanvasDialogCommand
|
||||
* @group outside_in
|
||||
* @coversDefaultClass \Drupal\settings_tray\Ajax\OpenOffCanvasDialogCommand
|
||||
* @group settings_tray
|
||||
*/
|
||||
class OpenOffCanvasDialogCommandTest extends UnitTestCase {
|
||||
|
Loading…
Reference in New Issue