-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Ajuste boas praticas Magento e menu de configurações no admin
- Loading branch information
Showing
33 changed files
with
280 additions
and
174 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Block\Adminhtml\System\Config\Form\Field; | ||
|
||
|
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 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Model\Config\Source; | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Model\Config\Source; | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Model\Config\Source; | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Model\Config\Source; | ||
|
||
|
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,51 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Observer; | ||
|
||
use Magento\Framework\Event\Observer; | ||
use Magento\Framework\Event\ObserverInterface; | ||
use Magento\Framework\Exception\InputException; | ||
use Magento\Framework\Message\Session; | ||
use Magento\Framework\Stdlib\CookieManagerInterface; | ||
use Magento\Framework\Stdlib\Cookie\FailureToSendException; | ||
|
||
/** | ||
* Class ClearMessages | ||
* @package Gg2\ToastMessage\Observer | ||
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse) | ||
*/ | ||
class ClearMessages implements ObserverInterface | ||
{ | ||
protected Session $session; | ||
protected CookieManagerInterface $cookieManager; | ||
|
||
/** | ||
* ClearMessages constructor. | ||
* @param Session $session | ||
* @param CookieManagerInterface $cookieManager | ||
*/ | ||
public function __construct( | ||
Session $session, | ||
CookieManagerInterface $cookieManager | ||
) | ||
{ | ||
$this->session = $session; | ||
$this->cookieManager = $cookieManager; | ||
} | ||
|
||
/** | ||
* @param Observer $observer | ||
* @throws InputException | ||
* @throws FailureToSendException | ||
* @SuppressWarnings("unused") | ||
*/ | ||
public function execute(Observer $observer) | ||
{ | ||
$messages = $this->session->getData('default'); | ||
if ($messages && !empty($messages->getItems())) { | ||
$messages->clear(); | ||
$this->cookieManager->deleteCookie('mage-messages'); | ||
} | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Gg2\ToastMessage\Plugin\AdditionalConfig; | ||
|
||
use Gg2\ToastMessage\ViewModel\Settings; | ||
|
||
class AdditionalConfigProvider | ||
{ | ||
private Settings $settings; | ||
|
||
/** | ||
* AdditionalConfigProvider constructor. | ||
* @param Settings $settings | ||
*/ | ||
public function __construct(Settings $settings) | ||
{ | ||
$this->settings = $settings; | ||
} | ||
|
||
/** | ||
* @param \Magento\Checkout\Model\DefaultConfigProvider $subject | ||
* @param $output | ||
* @return array | ||
* @SuppressWarnings("unused") | ||
*/ | ||
public function afterGetConfig( | ||
\Magento\Checkout\Model\DefaultConfigProvider $subject, | ||
$output | ||
): array { | ||
$output['toastMessageSettings'] = $this->settings->getSettings(); | ||
return $output; | ||
} | ||
} |
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 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
Oops, something went wrong.