-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #2 - Add badge notification config setting
- Loading branch information
Showing
8 changed files
with
138 additions
and
9 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,34 @@ | ||
<?php | ||
/** | ||
* Copyright © MagePal LLC. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* https://www.magepal.com | [email protected] | ||
*/ | ||
|
||
namespace MagePal\Core\Helper; | ||
|
||
use Magento\Framework\App\Helper\AbstractHelper; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Data extends AbstractHelper | ||
{ | ||
const XML_PATH_ACTIVE = 'magepal_core/general/badge_notification'; | ||
const NOTIFICATION_DISABLED = 0; | ||
const NOTIFICATION_ENABLED = 1; | ||
const NOTIFICATION_WITHIN_TAB = 2; | ||
|
||
/** | ||
* If enabled | ||
* | ||
* @param null $scopeCode | ||
* @return bool | ||
*/ | ||
public function getBadgeNotificationValue($scopeCode = null) | ||
{ | ||
return (int) $this->scopeConfig->getValue( | ||
self::XML_PATH_ACTIVE, | ||
ScopeInterface::SCOPE_STORE, | ||
$scopeCode | ||
); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
/** | ||
* Copyright © MagePal LLC. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* http://www.magepal.com | [email protected] | ||
*/ | ||
|
||
namespace MagePal\Core\Model\Config\Source; | ||
|
||
use Magento\Framework\Option\ArrayInterface; | ||
use MagePal\Core\Helper\Data; | ||
|
||
class BadgeNotification implements ArrayInterface | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
return [ | ||
['value' => Data::NOTIFICATION_ENABLED, 'label' => 'Yes'], | ||
['value' => Data::NOTIFICATION_WITHIN_TAB, 'label' => 'When Tab Open'], | ||
['value' => Data::NOTIFICATION_DISABLED, 'label' => __('No')] | ||
]; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © MagePal LLC. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* https://www.magepal.com | [email protected] | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> | ||
<default> | ||
<magepal_core> | ||
<general> | ||
<badge_notification>1</badge_notification> | ||
</general> | ||
</magepal_core> | ||
</default> | ||
</config> |
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