Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
app/code/Magento/MediaGalleryUi/Ui/Component/Control/InsertAsstes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\MediaGalleryUi\Ui\Component\Control; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
use Magento\Framework\AuthorizationInterface; | ||
|
||
/** | ||
* Add selected button | ||
*/ | ||
class InsertAsstes implements ButtonProviderInterface | ||
{ | ||
private const ACL_INSERT_ASSETS = 'Magento_MediaGallery::insert_assets'; | ||
|
||
/** | ||
* @var AuthorizationInterface | ||
*/ | ||
private $authorization; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param AuthorizationInterface $authorization | ||
*/ | ||
public function __construct( | ||
AuthorizationInterface $authorization | ||
) { | ||
$this->authorization = $authorization; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getButtonData() | ||
{ | ||
$buttonData = [ | ||
'label' => __('Add Selected'), | ||
'on_click' => 'return false;");', | ||
'class' => 'action-primary no-display media-gallery-add-selected', | ||
'sort_order' => 110, | ||
]; | ||
|
||
if (!$this->authorization->isAllowed(self::ACL_INSERT_ASSETS)) { | ||
$buttonData['disabled'] = 'disabled'; | ||
} | ||
|
||
return $buttonData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters