Skip to content

Changes from upstream Magento release 2.4.7-p4 #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* Adminhtml dashboard recent orders grid
*
* @api
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.DepthOfInheritance)
* @since 100.0.2
*/
Expand Down Expand Up @@ -152,7 +151,7 @@ protected function _prepareColumns()
'header' => __('Total'),
'sortable' => false,
'type' => 'currency',
'currency_code' => $baseCurrencyCode,
'currency_code' => $this->_escaper->escapeHtml($baseCurrencyCode),
'index' => 'revenue'
]
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminClickAddOptionForBundleItemsActionGroup">
<annotations>
<description>Click 'Add Option' button for bundle items.</description>
</annotations>

<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function getElementHtml()
$html .= '<label class="admin__addon-suffix" for="' .
$this->getHtmlId() .
'"><span>' .
$this->directoryHelper->getWeightUnit() .
$this->_escaper->escapeHtml($this->directoryHelper->getWeightUnit()) .
'</span></label></div>';

if ($afterElementJs = $this->getAfterElementJs()) {
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ImageData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,14 @@
<data key="filename">png</data>
<data key="file_extension">png</data>
</entity>
<entity name="placeholderDummyBaseImage" type="imageFile">
<data key="file">Dummy(3).jpg</data>
<data key="name">Dummy(3)</data>
<data key="extension">jpg</data>
</entity>
<entity name="PageBuilderBackgroundImage_LargerThan2MB" type="imageFile">
<data key="file">LargerThan2MB.jpg</data>
<data key="name">LargerThan2MB</data>
<data key="extension">jpg</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,16 @@
<!--Admin deletes category-->
<comment userInput="Admin deletes category" stepKey="deleteCategoryComment"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="onCategoryPageToDeleteCategory"/>
<actionGroup ref="AdminDeleteCategoryByNameActionGroup" stepKey="cleanSimpleSubCategory">
<argument name="categoryName" value="SimpleSubCategory"/>
</actionGroup>
<actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory">
<argument name="categoryEntity" value="_defaultCategory"/>
</actionGroup>

<!--@TODO Move cleanup to "after" when MQE-830 is resolved-->
<!--Clean up categories-->
<comment userInput="Clean up categories" stepKey="cleanupCategoriesComment"/>
<actionGroup ref="DeleteCategoryActionGroup" stepKey="cleanSimpleSubCategory">
<argument name="categoryEntity" value="SimpleSubCategory"/>
</actionGroup>
<!--Clean up products-->
<comment userInput="Clean up simple product" stepKey="cleanUpSimpleProduct"/>
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProduct">
Expand Down
15 changes: 2 additions & 13 deletions app/code/Magento/Cms/Test/Fixture/Block.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
<?php
/************************************************************************
*
* Copyright 2023 Adobe
/**
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
* ************************************************************************
*/
declare(strict_types=1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
*/
-->
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="TinyMCESection">
<element name="checkIfContentTabOpen" type="button" selector="//span[text()='Content']/parent::strong/parent::*[@data-state-collapsible='closed']"/>
<element name="CheckIfTabExpand" type="button" selector="//div[@data-state-collapsible='closed']//span[text()='Content']"/>
<element name="TinyMCE" type="text" selector=".tox-tinymce"/>
<element name="InsertWidgetBtn" type="button" selector=".action-add-widget"/>
<element name="InsertWidgetIcon" type="button" selector="button[aria-label='Insert Widget']" timeout="30"/>
<element name="InsertWidgetIcon" type="button" selector="button[title='Insert Widget']" timeout="30"/>
<element name="InsertVariableBtn" type="button" selector=".scalable.add-variable.plugin"/>
<element name="InsertVariableIcon" type="button" selector="button[aria-label='Insert Variable']"/>
<element name="InsertVariableIcon" type="button" selector="button[title='Insert Variable']"/>
<element name="InsertImageBtn" type="button" selector=".scalable.action-add-image.plugin"/>
<element name="InsertImageIcon" type="button" selector="button[aria-label='Insert/edit image']" timeout="30"/>
<element name="Style" type="button" selector="button[aria-label='Block Paragraph']"/>
<element name="Bold" type="button" selector="button[aria-label='Bold']"/>
<element name="Italic" type="button" selector="button[aria-label='Italic']"/>
<element name="Underline" type="button" selector="button[aria-label='Underline']"/>
<element name="AlignLeft" type="button" selector="button[aria-label='Align left']"/>
<element name="AlignCenter" type="button" selector="button[aria-label='Align center']"/>
<element name="AlignRight" type="button" selector="button[aria-label='Align right']"/>
<element name="Bullet" type="button" selector="div[aria-label='Bullet list']"/>
<element name="Numlist" type="button" selector="div[aria-label='Numbered list']"/>
<element name="InsertLink" type="button" selector="button[aria-label='Insert/edit link']"/>
<element name="InsertTable" type="button" selector="button[aria-label='Table']"/>
<element name="SpecialCharacter" type="button" selector="button[aria-label='Special character']"/>
<element name="InsertImageIcon" type="button" selector="button[title='Insert/edit image']" timeout="30"/>
<element name="Style" type="button" selector="button[title='Block Paragraph']"/>
<element name="Bold" type="button" selector="button[title='Bold']"/>
<element name="Italic" type="button" selector="button[title='Italic']"/>
<element name="Underline" type="button" selector="button[title='Underline']"/>
<element name="AlignLeft" type="button" selector="button[title='Align left']"/>
<element name="AlignCenter" type="button" selector="button[title='Align center']"/>
<element name="AlignRight" type="button" selector="button[title='Align right']"/>
<element name="Bullet" type="button" selector="div[title='Bullet list']"/>
<element name="Numlist" type="button" selector="div[title='Numbered list']"/>
<element name="InsertLink" type="button" selector="button[title='Insert/edit link']"/>
<element name="InsertTable" type="button" selector="button[title='Table']"/>
<element name="SpecialCharacter" type="button" selector="button[title='Special character']"/>
<element name="WidgetButton" type="button" selector="span[class*='magento-widget mceNonEditable']"/>
<element name="EditorContent" type="input" selector="#tinymce"/>
<element name="Content" type="textarea" selector="textarea"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
<?php
/***
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
/************************************************************************
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
* ***********************************************************************
*/
declare(strict_types=1);

Expand All @@ -18,6 +28,7 @@
use Magento\Ui\Component\Container;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Magento\Cms\Api\Data\PageInterface;

class DataProviderTest extends TestCase
{
Expand Down Expand Up @@ -66,6 +77,17 @@ class DataProviderTest extends TestCase
*/
private $requestFieldName = 'id';

/**
* @var array
*/
private array $pageLayoutColumns = [
PageInterface::PAGE_LAYOUT,
PageInterface::CUSTOM_THEME,
PageInterface::CUSTOM_THEME_FROM,
PageInterface::CUSTOM_THEME_TO,
PageInterface::CUSTOM_ROOT_TEMPLATE
];

protected function setUp(): void
{
$this->authorizationMock = $this->getMockBuilder(Authorization::class)
Expand Down Expand Up @@ -111,10 +133,15 @@ protected function setUp(): void
*/
public function testPrepareMetadata()
{
$this->authorizationMock->expects($this->once())
$this->authorizationMock->expects($this->exactly(2))
->method('isAllowed')
->with('Magento_Cms::save')
->willReturn(false);
->willReturnMap(
[
['Magento_Cms::save', null, false],
['Magento_Cms::save_design', null, false],

]
);

$metadata = [
'cms_page_columns' => [
Expand All @@ -131,6 +158,21 @@ public function testPrepareMetadata()
]
];

foreach ($this->pageLayoutColumns as $column) {
$metadata['cms_page_columns']['children'][$column] = [
'arguments' => [
'data' => [
'config' => [
'editor' => [
'editorType' => false
],
'componentType' => Container::NAME
]
]
]
];
}

$this->assertEquals(
$metadata,
$this->dataProvider->prepareMetadata()
Expand Down
42 changes: 39 additions & 3 deletions app/code/Magento/Cms/Ui/Component/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
*/
namespace Magento\Cms\Ui\Component;

use Magento\Cms\Api\Data\PageInterface;
use Magento\Framework\Api\Filter;
use Magento\Framework\Api\FilterBuilder;
use Magento\Framework\Api\Search\SearchCriteriaBuilder;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\AuthorizationInterface;
use Magento\Framework\View\Element\UiComponent\DataProvider\Reporting;
use Magento\Ui\Component\Container;

/**
* DataProvider for cms ui.
Expand All @@ -28,6 +30,17 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi
*/
private $additionalFilterPool;

/**
* @var array
*/
private array $pageLayoutColumns = [
PageInterface::PAGE_LAYOUT,
PageInterface::CUSTOM_THEME,
PageInterface::CUSTOM_THEME_FROM,
PageInterface::CUSTOM_THEME_TO,
PageInterface::CUSTOM_ROOT_TEMPLATE
];

/**
* @param string $name
* @param string $primaryFieldName
Expand Down Expand Up @@ -73,6 +86,8 @@ public function __construct(
* Get authorization info.
*
* @deprecated 101.0.7
* @see nothing
*
* @return AuthorizationInterface|mixed
*/
private function getAuthorizationInstance()
Expand Down Expand Up @@ -101,21 +116,42 @@ public function prepareMetadata()
'editorConfig' => [
'enabled' => false
],
'componentType' => \Magento\Ui\Component\Container::NAME
'componentType' => Container::NAME
]
]
]
]
];
}

if (!$this->getAuthorizationInstance()->isAllowed('Magento_Cms::save_design')) {

foreach ($this->pageLayoutColumns as $column) {
$metadata['cms_page_columns']['children'][$column] = [
'arguments' => [
'data' => [
'config' => [
'editor' => [
'editorType' => false
],
'componentType' => Container::NAME
]
]
]
];
}
}

return $metadata;
}

/**
* @inheritdoc
* Add Filter
*
* @param Filter $filter
* @return void
*/
public function addFilter(Filter $filter)
public function addFilter(Filter $filter): void
{
if (!empty($this->additionalFilterPool[$filter->getField()])) {
$this->additionalFilterPool[$filter->getField()]->addFilter($this->searchCriteriaBuilder, $filter);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Cms/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<argument name="adapterOptions" xsi:type="array">
<item name="tinymce" xsi:type="array">
<item name="value" xsi:type="string">mage/adminhtml/wysiwyg/tiny_mce/tinymceAdapter</item>
<item name="label" xsi:type="string" translatable="true">TinyMCE 7</item>
<item name="label" xsi:type="string" translatable="true">TinyMCE 6</item>
</item>
</argument>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function _getDeleteCheckbox()
$html .= '<input type="hidden" name="' .
parent::getName() .
'[value]" value="' .
$this->getValue() .
$this->_escaper->escapeHtml($this->getValue()) .
'" />';
$html .= '</div>';
}
Expand Down
Loading
Loading