Skip to content

Commit d2bc662

Browse files
authored
Merge branch '2.4-develop' into framework-EnumLookup
2 parents c68c447 + edc018c commit d2bc662

File tree

75 files changed

+1959
-758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1959
-758
lines changed

app/code/Magento/Catalog/view/adminhtml/web/js/components/product-ui-select.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/**
7+
* @deprecated see Magento/Ui/view/base/web/js/grid/filters/elements/ui-select.js
8+
*/
69
define([
710
'Magento_Ui/js/form/element/ui-select',
811
'jquery',
Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,63 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
87

9-
class OnInsert extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
8+
use Magento\Backend\App\Action\Context;
9+
use Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
10+
use Magento\Cms\Model\Wysiwyg\Images\GetInsertImageContent;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
12+
use Magento\Framework\Controller\Result\RawFactory;
13+
use Magento\Framework\Controller\ResultInterface;
14+
use Magento\Framework\Registry;
15+
16+
class OnInsert extends Images implements HttpPostActionInterface
1017
{
1118
/**
12-
* @var \Magento\Framework\Controller\Result\RawFactory
19+
* @var RawFactory
1320
*/
1421
protected $resultRawFactory;
1522

1623
/**
17-
* @param \Magento\Backend\App\Action\Context $context
18-
* @param \Magento\Framework\Registry $coreRegistry
19-
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
24+
* @var GetInsertImageContent
25+
*/
26+
private $getInsertImageContent;
27+
28+
/**
29+
* @param Context $context
30+
* @param Registry $coreRegistry
31+
* @param RawFactory $resultRawFactory
32+
* @param GetInsertImageContent $getInsertImageContent
2033
*/
2134
public function __construct(
22-
\Magento\Backend\App\Action\Context $context,
23-
\Magento\Framework\Registry $coreRegistry,
24-
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory
35+
Context $context,
36+
Registry $coreRegistry,
37+
RawFactory $resultRawFactory,
38+
?GetInsertImageContent $getInsertImageContent = null
2539
) {
2640
$this->resultRawFactory = $resultRawFactory;
2741
parent::__construct($context, $coreRegistry);
42+
$this->getInsertImageContent = $getInsertImageContent ?: $this->_objectManager
43+
->get(GetInsertImageContent::class);
2844
}
2945

3046
/**
31-
* Fire when select image
47+
* Return a content (just a link or an html block) for inserting image to the content
3248
*
33-
* @return \Magento\Framework\Controller\ResultInterface
49+
* @return ResultInterface
3450
*/
3551
public function execute()
3652
{
37-
$imagesHelper = $this->_objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
38-
$request = $this->getRequest();
39-
40-
$storeId = $request->getParam('store');
41-
42-
$filename = $request->getParam('filename');
43-
$filename = $imagesHelper->idDecode($filename);
44-
45-
$asIs = $request->getParam('as_is');
46-
47-
$forceStaticPath = $request->getParam('force_static_path');
48-
49-
$this->_objectManager->get(\Magento\Catalog\Helper\Data::class)->setStoreId($storeId);
50-
$imagesHelper->setStoreId($storeId);
51-
52-
if ($forceStaticPath) {
53-
$image = parse_url($imagesHelper->getCurrentUrl() . $filename, PHP_URL_PATH);
54-
} else {
55-
$image = $imagesHelper->getImageHtmlDeclaration($filename, $asIs);
56-
}
57-
58-
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
59-
$resultRaw = $this->resultRawFactory->create();
60-
return $resultRaw->setContents($image);
53+
$data = $this->getRequest()->getParams();
54+
return $this->resultRawFactory->create()->setContents(
55+
$this->getInsertImageContent->execute(
56+
$data['filename'],
57+
$data['force_static_path'],
58+
$data['as_is'],
59+
isset($data['store']) ? (int) $data['store'] : null
60+
)
61+
);
6162
}
6263
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Cms\Model\Wysiwyg\Images;
10+
11+
use Magento\Catalog\Helper\Data as CatalogHelper;
12+
use Magento\Cms\Helper\Wysiwyg\Images as ImagesHelper;
13+
14+
class GetInsertImageContent
15+
{
16+
/**
17+
* @var ImagesHelper
18+
*/
19+
private $imagesHelper;
20+
21+
/**
22+
* @var CatalogHelper
23+
*/
24+
private $catalogHelper;
25+
26+
/**
27+
* @param ImagesHelper $imagesHelper
28+
* @param CatalogHelper $catalogHelper
29+
*/
30+
public function __construct(ImagesHelper $imagesHelper, CatalogHelper $catalogHelper)
31+
{
32+
$this->imagesHelper = $imagesHelper;
33+
$this->catalogHelper = $catalogHelper;
34+
}
35+
36+
/**
37+
* Create a content (just a link or an html block) for inserting image to the content
38+
*
39+
* @param string $encodedFilename
40+
* @param bool $forceStaticPath
41+
* @param bool $renderAsTag
42+
* @param int|null $storeId
43+
* @return string
44+
*/
45+
public function execute(
46+
string $encodedFilename,
47+
bool $forceStaticPath,
48+
bool $renderAsTag,
49+
?int $storeId = null
50+
): string {
51+
$filename = $this->imagesHelper->idDecode($encodedFilename);
52+
53+
$this->catalogHelper->setStoreId($storeId);
54+
$this->imagesHelper->setStoreId($storeId);
55+
56+
if ($forceStaticPath) {
57+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
58+
return parse_url($this->imagesHelper->getCurrentUrl() . $filename, PHP_URL_PATH);
59+
}
60+
61+
return $this->imagesHelper->getImageHtmlDeclaration($filename, $renderAsTag);
62+
}
63+
}

app/code/Magento/MediaContentSynchronization/Console/Command/Synchronize.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace Magento\MediaContentSynchronization\Console\Command;
99

10-
use Magento\Framework\App\Area;
11-
use Magento\Framework\App\State;
1210
use Magento\Framework\Console\Cli;
1311
use Magento\MediaContentSynchronizationApi\Api\SynchronizeInterface;
1412
use Symfony\Component\Console\Command\Command;
@@ -25,21 +23,13 @@ class Synchronize extends Command
2523
*/
2624
private $synchronizeContent;
2725

28-
/**
29-
* @var State $state
30-
*/
31-
private $state;
32-
3326
/**
3427
* @param SynchronizeInterface $synchronizeContent
35-
* @param State $state
3628
*/
3729
public function __construct(
38-
SynchronizeInterface $synchronizeContent,
39-
State $state
30+
SynchronizeInterface $synchronizeContent
4031
) {
4132
$this->synchronizeContent = $synchronizeContent;
42-
$this->state = $state;
4333
parent::__construct();
4434
}
4535

@@ -58,12 +48,7 @@ protected function configure()
5848
protected function execute(InputInterface $input, OutputInterface $output)
5949
{
6050
$output->writeln('Synchronizing content with assets...');
61-
$this->state->emulateAreaCode(
62-
Area::AREA_ADMINHTML,
63-
function () {
64-
$this->synchronizeContent->execute();
65-
}
66-
);
51+
$this->synchronizeContent->execute();
6752
$output->writeln('Completed content synchronization.');
6853
return Cli::RETURN_SUCCESS;
6954
}

app/code/Magento/MediaGallery/etc/db_schema.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
99
<table name="media_gallery_asset" resource="default" engine="innodb" comment="Media Gallery Asset">
1010
<column xsi:type="int" name="id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
11-
<column xsi:type="varchar" name="path" length="255" nullable="true" comment="Path"/>
11+
<column xsi:type="text" name="path" nullable="true" comment="Path"/>
1212
<column xsi:type="varchar" name="title" length="255" nullable="true" comment="Title"/>
1313
<column xsi:type="text" name="description" nullable="true" comment="Description"/>
1414
<column xsi:type="varchar" name="source" length="255" nullable="true" comment="Source"/>
@@ -25,9 +25,6 @@
2525
<index referenceId="MEDIA_GALLERY_ID" indexType="btree">
2626
<column name="id"/>
2727
</index>
28-
<constraint xsi:type="unique" referenceId="MEDIA_GALLERY_ID_PATH_TITLE_CONTENT_TYPE_WIDTH_HEIGHT">
29-
<column name="path"/>
30-
</constraint>
3128
<index referenceId="MEDIA_GALLERY_ASSET_TITLE" indexType="fulltext">
3229
<column name="title"/>
3330
</index>

app/code/Magento/MediaGallery/etc/db_schema_whitelist.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"MEDIA_GALLERY_ASSET_TITLE": true
2121
},
2222
"constraint": {
23-
"MEDIA_GALLERY_ID_PATH_TITLE_CONTENT_TYPE_WIDTH_HEIGHT": true,
2423
"PRIMARY": true,
2524
"MEDIA_GALLERY_ASSET_PATH": true
2625
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\MediaGalleryCatalogUi\Controller\Adminhtml\Product;
10+
11+
use Magento\Framework\Controller\ResultInterface;
12+
use Magento\Backend\App\Action\Context;
13+
use Magento\Catalog\Api\ProductRepositoryInterface;
14+
use Magento\Framework\Controller\Result\JsonFactory;
15+
use Magento\Framework\App\Action\HttpGetActionInterface;
16+
use Magento\Backend\App\Action;
17+
18+
/**
19+
* Returns selected product by product id. for ui-select filter
20+
*/
21+
class GetSelected extends Action implements HttpGetActionInterface
22+
{
23+
/**
24+
* @see _isAllowed()
25+
*/
26+
const ADMIN_RESOURCE = 'Magento_Catalog::products';
27+
28+
/**
29+
* @var JsonFactory
30+
*/
31+
private $resultJsonFactory;
32+
33+
/**
34+
* @var ProductRepositoryInterface
35+
*/
36+
private $productRepository;
37+
38+
/**
39+
* GetSelected constructor.
40+
*
41+
* @param JsonFactory $jsonFactory
42+
* @param ProductRepositoryInterface $productRepository
43+
* @param Context $context
44+
*/
45+
public function __construct(
46+
JsonFactory $jsonFactory,
47+
ProductRepositoryInterface $productRepository,
48+
Context $context
49+
) {
50+
$this->resultJsonFactory = $jsonFactory;
51+
$this->productRepository = $productRepository;
52+
parent::__construct($context);
53+
}
54+
55+
/**
56+
* Return selected products options
57+
*
58+
* @return ResultInterface
59+
*/
60+
public function execute() : ResultInterface
61+
{
62+
$productIds = $this->getRequest()->getParam('ids');
63+
$options = [];
64+
65+
if (!is_array($productIds)) {
66+
return $this->resultJsonFactory->create()->setData('parameter ids must be type of array');
67+
}
68+
foreach ($productIds as $id) {
69+
try {
70+
$product = $this->productRepository->getById($id);
71+
$options[] = [
72+
'value' => $product->getId(),
73+
'label' => $product->getName(),
74+
'is_active' => $product->getSatus(),
75+
'path' => $product->getSku()
76+
];
77+
} catch (\Exception $e) {
78+
continue;
79+
}
80+
}
81+
82+
return $this->resultJsonFactory->create()->setData($options);
83+
}
84+
}

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertCategoryGridPageDetailsActionGroup.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSearchCategoryGridPageByCategoryNameActionGroup">
12+
<annotations>
13+
<description>Fills 'Search by category name' on Category Grid page. Clicks on Submit Search.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="categoryName"/>
17+
</arguments>
18+
19+
<conditionalClick selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.clearFilters}}" dependentSelector="{{AdminMediaGalleryCatalogUiCategoryGridSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
20+
<fillField selector="{{AdminMediaGalleryCatalogUiCategoryGridSearchSection.searchInput}}" userInput="{{categoryName}}" stepKey="fillKeywordSearchField"/>
21+
<click selector="{{AdminMediaGalleryCatalogUiCategoryGridSearchSection.submitSearch}}" stepKey="clickKeywordSearch"/>
22+
<waitForLoadingMaskToDisappear stepKey="waitingForLoading" />
23+
</actionGroup>
24+
</actionGroups>

0 commit comments

Comments
 (0)