-
Notifications
You must be signed in to change notification settings - Fork 17
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
10 changed files
with
165 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace Macopedia\Allegro\Block\Adminhtml\Offer; | ||
|
||
use Magento\Catalog\Api\Data\ProductInterface; | ||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
/** | ||
* Back button configuration provider | ||
*/ | ||
class BackButton implements ButtonProviderInterface | ||
{ | ||
/** | ||
* Url Builder | ||
* | ||
* @var \Magento\Framework\UrlInterface | ||
*/ | ||
protected $urlBuilder; | ||
|
||
/** | ||
* Registry | ||
* | ||
* @var \Magento\Framework\Registry | ||
*/ | ||
protected $registry; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Magento\Backend\Block\Widget\Context $context | ||
* @param \Magento\Framework\Registry $registry | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Widget\Context $context, | ||
\Magento\Framework\Registry $registry | ||
) { | ||
$this->urlBuilder = $context->getUrlBuilder(); | ||
$this->registry = $registry; | ||
} | ||
|
||
/** | ||
* Return button attributes array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Back'), | ||
'class' => 'action- scalable back', | ||
'on_click' => $this->getOnclick(), | ||
'sort_order' => 10, | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getOnClick() | ||
{ | ||
return sprintf( | ||
"location.href = '%s';", | ||
$this->urlBuilder->getUrl('catalog/product/edit', ['id' => $this->getProduct()->getId()]) | ||
); | ||
} | ||
|
||
/** | ||
* @return ProductInterface | ||
*/ | ||
private function getProduct() | ||
{ | ||
return $this->registry->registry('product'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Copyright © Macopedia. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Macopedia\Allegro\Model\Config\CommentText; | ||
|
||
use Magento\Config\Model\Config\CommentInterface; | ||
|
||
class CallbackUrl implements CommentInterface | ||
{ | ||
/** | ||
* @var \Magento\Backend\Model\UrlInterface | ||
*/ | ||
protected $url; | ||
|
||
/** | ||
* CallbackUrl constructor. | ||
* @param \Magento\Backend\Model\UrlInterface $url | ||
*/ | ||
public function __construct(\Magento\Backend\Model\UrlInterface $url) | ||
{ | ||
$this->url = $url; | ||
} | ||
|
||
public function getCommentText($elementValue) | ||
{ | ||
$this->url->setNoSecret(true); | ||
return $this->url->getUrl('allegro/system/authenticate'); | ||
} | ||
} |
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
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