Skip to content
Snippets Groups Projects
Commit fd379455 authored by Kostia Bohach's avatar Kostia Bohach
Browse files

Fixed merge conflict

parent b75c35de
No related branches found
No related tags found
1 merge request!5343Issue #3305066 by quietone, Rename RedirectLeadingSlashesSubscriber
Showing
with 9 additions and 432 deletions
......@@ -921,67 +921,4 @@ protected function addDebugOutput(array $elements, bool $is_cache_hit, array $pr
return $elements;
}
/**
* Add cache debug information to the render array.
*
* @param array $elements
* The renderable array that must be wrapped with the cache debug output.
* @param bool $is_cache_hit
* A flag indicating that the cache is hit or miss.
* @param array $pre_bubbling_elements
* The renderable array for pre-bubbling elements.
* @param float $render_time
* The rendering time.
*
* @return array
* The renderable array.
*/
protected function addDebugOutput(array $elements, bool $is_cache_hit, array $pre_bubbling_elements = [], float $render_time = 0) {
if (empty($elements['#markup'])) {
return $elements;
}
$debug_items = [
'CACHE' => &$elements,
'PRE-BUBBLING CACHE' => &$pre_bubbling_elements,
];
$prefix = "<!-- START RENDERER -->";
$prefix .= "\n<!-- CACHE-HIT: " . ($is_cache_hit ? 'Yes' : 'No') . " -->";
foreach ($debug_items as $name_prefix => $debug_item) {
if (!empty($debug_item['#cache']['tags'])) {
$prefix .= "\n<!-- " . $name_prefix . " TAGS:";
foreach ($debug_item['#cache']['tags'] as $tag) {
$prefix .= "\n * " . $tag;
}
$prefix .= "\n-->";
}
if (!empty($debug_item['#cache']['contexts'])) {
$prefix .= "\n<!-- " . $name_prefix . " CONTEXTS:";
foreach ($debug_item['#cache']['contexts'] as $context) {
$prefix .= "\n * " . $context;
}
$prefix .= "\n-->";
}
if (!empty($debug_item['#cache']['keys'])) {
$prefix .= "\n<!-- " . $name_prefix . " KEYS:";
foreach ($debug_item['#cache']['keys'] as $key) {
$prefix .= "\n * " . $key;
}
$prefix .= "\n-->";
}
if (!empty($debug_item['#cache']['max-age'])) {
$prefix .= "\n<!-- " . $name_prefix . " MAX-AGE: " . $debug_item['#cache']['max-age'] . " -->";
}
}
if (!empty($render_time)) {
$prefix .= "\n<!-- RENDERING TIME: " . number_format($render_time, 9) . " -->";
}
$suffix = "<!-- END RENDERER -->";
$elements['#markup'] = Markup::create("$prefix\n" . $elements['#markup'] . "\n$suffix");
return $elements;
}
}
......@@ -29,11 +29,6 @@ class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInte
*/
protected array $themes;
/**
* List of themes available on the destination.
*/
protected array $themes;
/**
* Constructs a BlockTheme object.
*
......
......@@ -392,67 +392,6 @@ protected function enableDisabledToolbarItem(string $toolbar_item_id): void {
$assert_session->elementExists('css', ".ckeditor5-toolbar-active .ckeditor5-toolbar-item-$toolbar_item_id");
}
/**
* Gets the titles of the vertical tabs in the given container.
*
* @param string $container_selector
* The container in which to look for vertical tabs.
* @param bool $visible_only
* (optional) Whether to restrict to only the visible vertical tabs. TRUE by
* default.
*
* @return string[]
* The titles of all vertical tabs menu items, restricted to only
* visible ones by default.
*
* @throws \LogicException
*/
private function getVerticalTabs(string $container_selector, bool $visible_only = TRUE): array {
$page = $this->getSession()->getPage();
// Ensure the container exists.
$container = $page->find('css', $container_selector);
if ($container === NULL) {
throw new \LogicException('The given container should exist.');
}
// Make sure that the container selector contains exactly one Vertical Tabs
// UI component.
$vertical_tabs = $container->findAll('css', '.vertical-tabs');
if (count($vertical_tabs) != 1) {
throw new \LogicException('The given container should contain exactly one Vertical Tabs component.');
}
$vertical_tabs = $container->findAll('css', '.vertical-tabs__menu-item');
$vertical_tabs_titles = [];
foreach ($vertical_tabs as $vertical_tab) {
if ($visible_only && !$vertical_tab->isVisible()) {
continue;
}
$title = $vertical_tab->find('css', '.vertical-tabs__menu-item-title')->getHtml();
// When retrieving visible vertical tabs, mark the selected one.
if ($visible_only && $vertical_tab->hasClass('is-selected')) {
$title = "➡️$title";
}
$vertical_tabs_titles[] = $title;
}
return $vertical_tabs_titles;
}
/**
* Enables a disabled CKEditor 5 toolbar item.
*
* @param string $toolbar_item_id
* The toolbar item to enable.
*/
protected function enableDisabledToolbarItem(string $toolbar_item_id): void {
$assert_session = $this->assertSession();
$assert_session->elementExists('css', ".ckeditor5-toolbar-disabled .ckeditor5-toolbar-item-$toolbar_item_id");
$this->triggerKeyUp(".ckeditor5-toolbar-item-$toolbar_item_id", 'ArrowDown');
$assert_session->elementNotExists('css', ".ckeditor5-toolbar-disabled .ckeditor5-toolbar-item-$toolbar_item_id");
$assert_session->elementExists('css', ".ckeditor5-toolbar-active .ckeditor5-toolbar-item-$toolbar_item_id");
}
/**
* Confirms active tab status is intact after AJAX refresh.
*/
......
......@@ -21,18 +21,4 @@
*/
class HelpTopicTwigLoader extends CoreHelpTopicTwigLoader {
/**
* {@inheritdoc}
*/
protected function findTemplate($name, $throw = TRUE) {
if (!str_ends_with($name, '.html.twig')) {
if (!$throw) {
return NULL;
}
$extension = pathinfo($name, PATHINFO_EXTENSION);
throw new LoaderError(sprintf("Help topic %s has an invalid file extension (%s). Only help topics ending .html.twig are allowed.", $name, $extension));
}
return parent::findTemplate($name, $throw);
}
}
name: 'Help Topics Twig Tester'
type: module
description: 'Support module for help testing.'
package: Testing
dependencies:
- drupal:help_topics
services:
help_test_twig.extension:
class: Drupal\help_topics_twig_tester\HelpTestTwigExtension
arguments: []
tags:
- { name: twig.extension, priority: 500 }
<?php
namespace Drupal\help_topics_twig_tester;
use Twig\Extension\AbstractExtension;
/**
* Defines and registers Drupal Twig extensions for testing help topics.
*/
class HelpTestTwigExtension extends AbstractExtension {
/**
* {@inheritdoc}
*/
public function getNodeVisitors() {
return [
new HelpTestTwigNodeVisitor(),
];
}
}
<?php
namespace Drupal\help_topics_twig_tester;
use Drupal\Core\Template\TwigNodeTrans;
use Twig\Environment;
use Twig\Node\Node;
use Twig\Node\PrintNode;
use Twig\Node\SetNode;
use Twig\Node\TextNode;
use Twig\Node\Expression\AbstractExpression;
use Twig\NodeVisitor\AbstractNodeVisitor;
/**
* Defines a Twig node visitor for testing help topics.
*
* See static::setStateValue() for information on the special processing
* this class can do.
*/
class HelpTestTwigNodeVisitor extends AbstractNodeVisitor {
/**
* Delimiter placed around single translated chunks.
*/
public const DELIMITER = 'Not Likely To Be Inside A Template';
/**
* Name used in \Drupal::state() for saving state information.
*/
protected const STATE_NAME = 'help_test_twig_node_visitor';
/**
* {@inheritdoc}
*/
protected function doEnterNode(Node $node, Environment $env) {
return $node;
}
/**
* {@inheritdoc}
*/
protected function doLeaveNode(Node $node, Environment $env) {
$processing = static::getState();
if (!$processing['manner']) {
return $node;
}
// For all special processing, we want to remove variables, set statements,
// and assorted Twig expression calls (if, do, etc.).
if ($node instanceof SetNode || $node instanceof PrintNode ||
$node instanceof AbstractExpression) {
return NULL;
}
if ($node instanceof TwigNodeTrans) {
// Count the number of translated chunks.
$this_chunk = $processing['chunk_count'] + 1;
static::setStateValue('chunk_count', $this_chunk);
if ($this_chunk > $processing['max_chunk']) {
static::setStateValue('max_chunk', $this_chunk);
}
if ($processing['manner'] == 'remove_translated') {
// Remove all translated text.
return NULL;
}
elseif ($processing['manner'] == 'replace_translated') {
// Replace with a dummy string.
$node = new TextNode('dummy', 0);
}
elseif ($processing['manner'] == 'translated_chunk') {
// Return the text only if it's the next chunk we're supposed to return.
// Add a wrapper, because non-translated nodes will still be returned.
if ($this_chunk == $processing['return_chunk']) {
return new TextNode(static::DELIMITER . $this->extractText($node) . static::DELIMITER, 0);
}
else {
return NULL;
}
}
}
if ($processing['manner'] == 'remove_translated' && $node instanceof TextNode) {
// For this processing, we also want to remove all HTML tags and
// whitespace from TextNodes.
$text = $node->getAttribute('data');
$text = strip_tags($text);
$text = preg_replace('|\s+|', '', $text);
return new TextNode($text, 0);
}
return $node;
}
/**
* {@inheritdoc}
*/
public function getPriority() {
return -100;
}
/**
* Extracts the text from a translated text object.
*
* @param \Drupal\Core\Template\TwigNodeTrans $node
* Translated text node.
*
* @return string
* Text in the node.
*/
protected function extractText(TwigNodeTrans $node) {
// Extract the singular/body and optional plural text from the
// TwigNodeTrans object.
$bodies = $node->getNode('body');
if (!count($bodies)) {
$bodies = [$bodies];
}
if ($node->hasNode('plural')) {
$plural = $node->getNode('plural');
if (!count($plural)) {
$bodies[] = $plural;
}
else {
foreach ($plural as $item) {
$bodies[] = $item;
}
}
}
// Extract the text from each component of the singular/plural strings.
$text = '';
foreach ($bodies as $body) {
if ($body->hasAttribute('data')) {
$text .= $body->getAttribute('data');
}
}
return trim($text);
}
/**
* Returns the state information.
*
* @return array
* The state information.
*/
public static function getState() {
return \Drupal::state()->get(static::STATE_NAME, ['manner' => 0]);
}
/**
* Sets state information.
*
* @param string $key
* Key to set. Possible keys:
* - manner: Type of special processing to do when rendering. Values:
* - 0: No processing.
* - remove_translated: Remove all translated text, HTML tags, and
* whitespace.
* - replace_translated: Replace all translated text with dummy text.
* - translated_chunk: Remove all translated text except one designated
* chunk (see return_chunk below).
* - bare_body (or any other non-zero value): Remove variables, set
* statements, and Twig programming, but leave everything else intact.
* - chunk_count: Current index of translated chunks. Reset to -1 before
* each rendering run. (Used internally by this class.)
* - max_chunk: Maximum index of translated chunks. Reset to -1 before
* each rendering run.
* - return_chunk: Chunk index to keep intact for translated_chunk
* processing. All others are removed.
* @param $value
* Value to set for $key.
*/
public static function setStateValue(string $key, $value) {
$state = \Drupal::state();
$values = $state->get(static::STATE_NAME, ['manner' => 0]);
$values[$key] = $value;
$state->set(static::STATE_NAME, $values);
}
}
......@@ -11,11 +11,6 @@
*/
class LanguageNegotiationMethodManager extends DefaultPluginManager {
/**
* The cache key prefix.
*/
protected string $cacheKeyPrefix;
/**
* Constructs a new LanguageNegotiationMethodManager object.
*
......
......@@ -24,11 +24,6 @@ class FieldUiIntegrationTest extends MediaLibraryTestBase {
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\system\Kernel\System;
use Drupal\Core\Flood\DatabaseBackend;
use Drupal\Core\Flood\MemoryBackend;
use Drupal\KernelTests\KernelTestBase;
/**
......
......@@ -37,7 +37,6 @@
*
* @ingroup views_plugins
*/
#[\AllowDynamicProperties]
abstract class PluginBase extends ComponentPluginBase implements ContainerFactoryPluginInterface, ViewsPluginInterface, DependentPluginInterface, TrustedCallbackInterface {
/**
......
......@@ -150,7 +150,6 @@
*
* Extensions of this class can be used to create more interesting joins.
*/
#[\AllowDynamicProperties]
class JoinPluginBase extends PluginBase implements JoinPluginInterface {
/**
......
......@@ -87,24 +87,6 @@ public function providerGetArgument() {
NULL,
];
$data[] = [
['query_param' => 'test[tier1][tier2][tier3]'],
new Request(['test' => ['tier1' => ['tier2' => ['tier3' => 'foo']]]]),
'foo',
];
$data[] = [
['query_param' => 'test[tier1][tier2]'],
new Request(['test' => ['tier1' => ['tier2' => ['foo', 'bar']]]]),
'foo,bar',
];
$data[] = [
['query_param' => 'test[tier1][tier2]'],
new Request(['test' => 'foo']),
NULL,
];
return $data;
}
......
......@@ -98,21 +98,4 @@ public function testThemingThrobberElement() {
$web_assert->assertNoElementAfterWait('css', '.ajax-progress-throbber');
}
/**
* Tests progress throbber element position.
*/
public function testProgressThrobberPosition() {
$this->drupalLogin($this->rootUser);
$this->drupalGet('/admin/structure/block');
$this->clickLink('Place block');
hold_test_response(FALSE);
$this->assertSession()->waitForText('Place Block');
$this->clickLink('Place block');
hold_test_response(TRUE);
$this->assertSession()->elementExists('xpath', '//div[contains(@class, "dropbutton-wrapper")]/following-sibling::div[contains(@class, "ajax-progress-throbber")]');
hold_test_response(FALSE);
$this->assertSession()->assertNoElementAfterWait('css', '.ajax-progress-throbber');
}
}
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\Core\Render;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\ContextCacheKeys;
use Drupal\Core\Cache\MemoryBackend;
use Drupal\Core\Cache\VariationCache;
......
......@@ -6,15 +6,13 @@
*/
@media print {
* {
/* Black prints faster */
/* https://github.com/h5bp/main.css/blob/main/dist/_print.css#L14 */
color: #000 !important;
background-color: transparent !important;
box-shadow: none !important;
text-shadow: none !important;
}
* {
/* Black prints faster */
/* https://github.com/h5bp/main.css/blob/main/dist/_print.css#L14 */
}
body {
padding-top: 0;
}
......
......@@ -218,7 +218,7 @@ td .claro-details {
/* stylelint-disable-next-line unit-allowed-list */
@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) {
@media not all and (min-resolution: 0.001dpcm) {
@supports (-webkit-appearance: none) {
.claro-details__summary::before {
transition: none;
......@@ -364,7 +364,7 @@ td .claro-details {
/* stylelint-disable-next-line unit-allowed-list */
@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) {
@media not all and (min-resolution: 0.001dpcm) {
@supports (-webkit-appearance: none) {
.claro-details__summary::after {
transition: none;
......
......@@ -28,9 +28,6 @@
.modules-table-filter .form-item__description,
.permissions-table-filter .form-item__description {
position: absolute !important;
}
.modules-table-filter .form-item__description {
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
width: 1px;
......
......@@ -794,12 +794,9 @@
left: 0.625rem;
}
.media-library-item__edit {
border: 1px solid var(--color-gray-200) !important;
}
.media-library-item__edit {
/* !important to override button class border. */
border: 1px solid var(--color-gray-200) !important;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cg fill='%23545560'%3e%3cpath d='M14.545 3.042l-1.586-1.585a1.003 1.003 0 00-1.414 0L10.252 2.75l3 3 1.293-1.293a1.004 1.004 0 000-1.415zM5.25 13.751l-3-3 6.998-6.998 3 3zM.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: center;
......@@ -810,16 +807,6 @@
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%23ffffff' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%23ffffff' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%23ffffff' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
}
.media-library-item__remove,
.media-library-item__remove.button,
.media-library-item__remove.button:first-child,
.media-library-item__remove.button:disabled,
.media-library-item__remove.button:disabled:active,
.media-library-item__remove.button:hover,
.media-library-item__remove.button:focus {
border: 1px solid var(--color-gray-200) !important;
}
.media-library-item__remove,
.media-library-item__remove.button,
.media-library-item__remove.button:first-child,
......@@ -828,22 +815,18 @@
.media-library-item__remove.button:hover,
.media-library-item__remove.button:focus {
/* !important to override button class border. */
border: 1px solid var(--color-gray-200) !important;
background-image: url("data:image/svg+xml,%3csvg width='16' height='16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2.344 2.343l11.313 11.313M2.344 13.657L13.657 2.343' stroke='%2355565B' stroke-width='3'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: center;
background-size: 0.75rem;
}
.media-library-item__remove:active,
.media-library-item__remove.button:active,
.media-library-item__remove.button:disabled:active {
border-color: var(--color-absolutezero) !important;
}
.media-library-item__remove:active,
.media-library-item__remove.button:active,
.media-library-item__remove.button:disabled:active {
/* !important to override button class border. */
border-color: var(--color-absolutezero) !important;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3e%3cpath fill='%23ffffff' d='M3.51 13.925c.194.194.512.195.706.001l3.432-3.431c.194-.194.514-.194.708 0l3.432 3.431c.192.194.514.193.707-.001l1.405-1.417c.191-.195.189-.514-.002-.709l-3.397-3.4c-.192-.193-.192-.514-.002-.708l3.401-3.43c.189-.195.189-.515 0-.709l-1.407-1.418c-.195-.195-.513-.195-.707-.001l-3.43 3.431c-.195.194-.516.194-.708 0l-3.432-3.431c-.195-.195-.512-.194-.706.001l-1.407 1.417c-.194.195-.194.515 0 .71l3.403 3.429c.193.195.193.514-.001.708l-3.4 3.399c-.194.195-.195.516-.001.709l1.406 1.419z'/%3e%3c/svg%3e");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment