Skip to content

Commit f0f7a9d

Browse files
Merge pull request #79 from magento-cia/2.4.5-develop-2.4-develop-sync-05312022
Sync of 2.4.5-develop with 2.4-develop
2 parents 829c0d9 + 3e199fd commit f0f7a9d

File tree

7 files changed

+68
-13
lines changed

7 files changed

+68
-13
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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\AdobeStockAdminUi\Block\Adminhtml\System\Config;
10+
11+
use Magento\Config\Block\System\Config\Form\Field;
12+
use Magento\Framework\Data\Form\Element\AbstractElement;
13+
14+
/**
15+
* Hide Admin Adobe IMS status in admin system config
16+
*/
17+
class HideAdminAdobeImsStatus extends Field
18+
{
19+
/**
20+
* Hide Admin Adobe IMS enabled/disabled status
21+
*
22+
* @param AbstractElement $element
23+
* @param string $html
24+
* @return string
25+
*/
26+
protected function _decorateRowHtml(AbstractElement $element, $html)
27+
{
28+
$style = ' style="display: none"';
29+
30+
return '<tr id="row_' . $element->getHtmlId() . '"' . $style .'>' . $html . '</tr>';
31+
}
32+
}

AdobeStockAdminUi/Block/Adminhtml/System/Config/TestConnection.php

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
namespace Magento\AdobeStockAdminUi\Block\Adminhtml\System\Config;
1010

11+
use Magento\AdminAdobeIms\Service\ImsConfig;
1112
use Magento\AdobeImsApi\Api\ConfigInterface;
1213
use Magento\AdobeStockClientApi\Api\ClientInterface;
1314
use Magento\Backend\Block\Template\Context;
1415
use Magento\Config\Block\System\Config\Form\Field;
16+
use Magento\Framework\App\ObjectManager;
1517
use Magento\Framework\Data\Form\Element\AbstractElement;
1618

1719
/**
@@ -22,7 +24,7 @@ class TestConnection extends Field
2224
private const TEST_CONNECTION_PATH = 'adobe_stock/system_config/testconnection';
2325

2426
/**
25-
* @inheritdoc
27+
* @var string
2628
*/
2729
protected $_template = 'Magento_AdobeStockAdminUi::system/config/connection.phtml';
2830

@@ -37,21 +39,28 @@ class TestConnection extends Field
3739
private $config;
3840

3941
/**
40-
* TestConnection constructor.
41-
*
42+
* @var ImsConfig
43+
*/
44+
private ImsConfig $adminAdobeImsConfig;
45+
46+
/**
4247
* @param ClientInterface $client
4348
* @param ConfigInterface $config
44-
* @param Context $context
45-
* @param array $data
49+
* @param Context $context
50+
* @param array $data
51+
* @param ImsConfig|null $adminAdobeImsConfig
4652
*/
4753
public function __construct(
4854
ClientInterface $client,
4955
ConfigInterface $config,
5056
Context $context,
51-
array $data = []
57+
array $data = [],
58+
?ImsConfig $adminAdobeImsConfig = null
5259
) {
5360
$this->client = $client;
5461
$this->config = $config;
62+
$this->adminAdobeImsConfig = $adminAdobeImsConfig
63+
?? ObjectManager::getInstance()->get(ImsConfig::class);
5564
parent::__construct($context, $data);
5665
}
5766

@@ -63,8 +72,13 @@ public function __construct(
6372
*/
6473
public function render(AbstractElement $element): string
6574
{
66-
$element->setData('scope', null);
67-
return parent::render($element);
75+
// render Test Connection button only if Admin Adobe IMS is disabled
76+
if (!$this->adminAdobeImsConfig->enabled()) {
77+
$element->setData('scope', null);
78+
return parent::render($element);
79+
}
80+
81+
return '';
6882
}
6983

7084
/**

AdobeStockAdminUi/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"require": {
55
"php": "~7.4.0||~8.1.0",
66
"magento/framework": "*",
7+
"magento/module-admin-adobe-ims": "*",
78
"magento/module-adobe-ims-api": "*",
89
"magento/module-adobe-stock-client-api": "*",
910
"magento/module-backend": "*",

AdobeStockAdminUi/etc/adminhtml/system.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@
1515
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1616
<config_path>adobe_stock/integration/enabled</config_path>
1717
</field>
18+
<field id="admin_adobe_ims_enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
19+
<label>Enabled Admin Adobe Ims</label>
20+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
21+
<config_path>adobe_ims/integration/admin_enabled</config_path>
22+
<frontend_model>Magento\AdobeStockAdminUi\Block\Adminhtml\System\Config\HideAdminAdobeImsStatus</frontend_model>
23+
</field>
1824
<field id="api_key" translate="label" type="obscure" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
1925
<label>API Key (Client ID)</label>
2026
<config_path>adobe_ims/integration/api_key</config_path>
2127
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
2228
<depends>
2329
<field id="enabled">1</field>
30+
<field id="admin_adobe_ims_enabled">0</field>
2431
</depends>
2532
</field>
2633
<field id="private_key" translate="label comment" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
@@ -29,6 +36,7 @@
2936
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
3037
<depends>
3138
<field id="enabled">1</field>
39+
<field id="admin_adobe_ims_enabled">0</field>
3240
</depends>
3341
<comment><![CDATA[Configure an Adobe Stock account on <a href="https://console.adobe.io" target="_blank">adobe.io</a> to get the API Key (Client ID) and Client Secret. You will not be able to use the integration without both the API Key and Client Secret.]]></comment>
3442
</field>

AdobeStockClientApi/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ The Magento_AdobeStockClientApi module serves as application program interface (
44

55
## Extensibility
66

7-
Extension developers can interact with the Magento_AdobeStockClientApi module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
7+
Extension developers can interact with the Magento_AdobeStockClientApi module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html).
88

9-
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_AdobeStockClientApi module.
9+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_AdobeStockClientApi module.
1010

1111
## Additional information
1212

13-
For information about significant changes in patch releases, see [2.3.x Release information](https://devdocs.magento.com/guides/v2.3/release-notes/bk-release-notes.html).
13+
For information about significant changes in patch releases, see [2.4.x Release information](https://devdocs.magento.com/guides/v2.4/release-notes/bk-release-notes.html).

AdobeStockImageAdminUi/view/adminhtml/web/template/signIn.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
class="adobe-sign-out-button"
4848
id="adobeImsSignOut"
4949
click="logout"
50+
data-bind="visible: !isGlobalSignInEnabled"
5051
data-role="signOutBtn"
5152
type="button">
5253
<span>Sign Out</span>

_metapackage/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"magento/module-adobe-stock-image-api": "*",
1111
"magento/module-adobe-stock-client": "*",
1212
"magento/module-adobe-stock-client-api": "*",
13-
"magento/module-adobe-stock-admin-ui": "*",
14-
"magento/adobe-ims": "*"
13+
"magento/module-adobe-stock-admin-ui": "*"
1514
}
1615
}

0 commit comments

Comments
 (0)