-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from magmodules/release/1.1.0
Release/1.1.0
- Loading branch information
Showing
58 changed files
with
1,384 additions
and
1,748 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
<?php | ||
/** | ||
* Copyright © Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magmodules\MessageBird\Block\Adminhtml\System\Config\Button; | ||
|
||
use Exception; | ||
use Magento\Backend\Block\Widget\Button; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magmodules\MessageBird\Api\Log\RepositoryInterface as LogRepository; | ||
|
||
/** | ||
* Log check button class | ||
*/ | ||
class Log extends Field | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $_template = 'Magmodules_MessageBird::system/config/button/log.phtml'; | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element): string | ||
{ | ||
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); | ||
return parent::render($element); | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* | ||
* @return string | ||
*/ | ||
public function _getElementHtml(AbstractElement $element): string | ||
{ | ||
return $this->_toHtml(); | ||
} | ||
|
||
/** | ||
* @param string $type | ||
* @return string | ||
*/ | ||
public function getDownloadUrl(string $type): string | ||
{ | ||
return $this->getUrl('messagebird/log/stream', ['type' => $type]); | ||
} | ||
|
||
/** | ||
* @param string $type | ||
* @return string | ||
*/ | ||
public function getButtonHtml(string $type): string | ||
{ | ||
try { | ||
return $this->getLayout() | ||
->createBlock(Button::class) | ||
->setData([ | ||
'id' => 'mm-ui-button_' . $type, | ||
'label' => __('Show last %1 %2 log records', LogRepository::STREAM_DEFAULT_LIMIT, $type) | ||
])->toHtml(); | ||
} catch (Exception $e) { | ||
return ''; | ||
} | ||
} | ||
} |
Oops, something went wrong.