|
8 | 8 | namespace Magento\Ui\Plugin\Config\Backend;
|
9 | 9 |
|
10 | 10 | use Magento\Config\Model\Config\Backend\Serialized\ArraySerialized;
|
11 |
| -use Magento\Framework\App\Area; |
12 | 11 | use Magento\Framework\App\RequestInterface;
|
13 |
| -use Magento\Framework\App\State; |
14 | 12 |
|
15 | 13 | /**
|
16 | 14 | * Plugin for ArraySerialized backend model
|
17 | 15 | * Automatically converts row1/row2/row3 format to numerically indexed arrays
|
18 |
| - * Only works in adminhtml area and on design config edit page |
| 16 | + * Only works on design config edit page |
19 | 17 | */
|
20 | 18 | class ArraySerializedPlugin
|
21 | 19 | {
|
22 |
| - private const DESIGN_CONFIG_EDIT_PAGE = ['theme_design_config_edit', '_design_config_edit']; |
| 20 | + private const DESIGN_CONFIG_EDIT_PAGE = '_design_config_edit'; |
23 | 21 |
|
24 | 22 | /**
|
25 |
| - * @param State $appState |
26 | 23 | * @param RequestInterface $request
|
27 | 24 | */
|
28 | 25 | public function __construct(
|
29 |
| - private readonly State $appState, |
30 | 26 | private readonly RequestInterface $request
|
31 | 27 | ) {
|
32 | 28 | }
|
33 | 29 |
|
34 | 30 | /**
|
35 |
| - * Convert string keys to numeric keys. Only applies in adminhtml area and on design config edit page |
| 31 | + * Convert string keys to numeric keys. Only applies on design config edit page |
36 | 32 | *
|
37 | 33 | * @param ArraySerialized $subject
|
38 | 34 | * @param ArraySerialized $result
|
39 | 35 | * @return ArraySerialized
|
40 | 36 | */
|
41 | 37 | public function afterAfterLoad(ArraySerialized $subject, ArraySerialized $result)
|
42 | 38 | {
|
43 |
| - // Only apply the conversion in adminhtml area and on design config edit page |
44 |
| - if ($this->appState->getAreaCode() !== Area::AREA_ADMINHTML || !$this->isDesignConfigEditPage()) { |
| 39 | + // Only apply the conversion on design config edit page |
| 40 | + if (!$this->isDesignConfigEditPage()) { |
45 | 41 | return $result;
|
46 | 42 | }
|
47 | 43 |
|
@@ -70,6 +66,6 @@ public function afterAfterLoad(ArraySerialized $subject, ArraySerialized $result
|
70 | 66 | */
|
71 | 67 | private function isDesignConfigEditPage(): bool
|
72 | 68 | {
|
73 |
| - return in_array($this->request->getFullActionName(), self::DESIGN_CONFIG_EDIT_PAGE); |
| 69 | + return str_ends_with($this->request->getFullActionName(), self::DESIGN_CONFIG_EDIT_PAGE); |
74 | 70 | }
|
75 | 71 | }
|
0 commit comments