Skip to content

Commit

Permalink
add color selector
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-sharethis committed Sep 14, 2023
1 parent fc219f8 commit 1ca1a92
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 1.1.0

Addition of Inline Share Button color selection.

## 1.0.0

Initial stable release.
2 changes: 1 addition & 1 deletion Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getInlineButtonsLanguage(): string
*/
public function getInlineButtonsColor(): string
{
return 'social';
return $this->getConfigValue('sharethis_inline_sharebuttons/general/color', 'social');
}

/**
Expand Down
36 changes: 36 additions & 0 deletions Model/System/Config/Source/InlineColorSelect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @author ShareThis
* @copyright Copyright (c) 2022 ShareThis (https://sharethis.com)
* @license https://www.gnu.org/licenses/gpl-3.0.html
* @package ShareThis_ShareButtons
*/

namespace ShareThis\ShareButtons\Model\System\Config\Source;

class InlineColorSelect extends OptionsArray
{

public const SOCIAL = 'social';

public const WHITE = 'white';

public const GRAY = 'gray';

public const BLACK = 'black';

/**
* Get option map of color options.
*
* @return array Option array map of color options.
*/
public function getOptionMap(): array
{
return [
self::SOCIAL => __('Social'),
self::WHITE => __('White'),
self::GRAY => __('Gray'),
self::BLACK => __('Black'),
];
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sharethis/magento-sharethis-sharebuttons",
"description": "ShareThis Share Buttons for Magento",
"type": "magento2-module",
"version": "1.0.0",
"version": "1.1.0",
"license": "proprietary",
"authors": [
{
Expand Down
4 changes: 4 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<label>Alignment</label>
<source_model>ShareThis\ShareButtons\Model\System\Config\Source\InlineAlignmentSelect</source_model>
</field>
<field id="color" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Color</label>
<source_model>ShareThis\ShareButtons\Model\System\Config\Source\InlineColorSelect</source_model>
</field>
<field id="language" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Language</label>
<source_model>ShareThis\ShareButtons\Model\System\Config\Source\LanguageSelect</source_model>
Expand Down
1 change: 1 addition & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<sharethis_inline_sharebuttons>
<general>
<alignment>center</alignment>
<color>social</color>
<enabled>0</enabled>
<has_spacing>1</has_spacing>
<label_size>small</label_size>
Expand Down
2 changes: 1 addition & 1 deletion registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (c) 2022 ShareThis (https://sharethis.com)
* @license https://www.gnu.org/licenses/gpl-3.0.html
* @package ShareThis_ShareButtons
* @version 1.0.0
* @version 1.1.0
*/

declare( strict_types=1 );
Expand Down

0 comments on commit 1ca1a92

Please sign in to comment.