Skip to content

Commit

Permalink
Release v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
allrude authored Apr 28, 2023
1 parent 58dccde commit 29331ab
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 206 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.1.0] - 2023-04-28
### Added
- Dedicated menu item for config
- Mastodon social option

### Changed
- Sample for rending each social icon

## [2.0.1] - 2022-12-17
### Fixed
- Dependancy version
Expand Down
5 changes: 5 additions & 0 deletions ViewModel/StoreInfoExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function getInstagram(): string
return (string) $this->getStoreInfoExtra('instagram_address');
}

public function getMastodon(): string
{
return (string) $this->getStoreInfoExtra('mastodon_address');
}

public function getPinterest(): string
{
return (string) $this->getStoreInfoExtra('pinterest_address');
Expand Down
Binary file modified assets/preview-social.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "siteation/magento2-storeinfo-extra",
"version": "2.0.1",
"version": "2.1.0",
"license": "MIT",
"type": "magento2-module",
"description": "Get your store information with ease",
Expand Down
116 changes: 106 additions & 10 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,140 @@
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"
>
<system>
<tab id="siteation" sortOrder="999" translate="label">
<label>Siteation</label>
</tab>

<section id="general">
<group id="store_information_extra" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<group id="store_information_extra" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Store Extra Information</label>
<field id="coc_number" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="coc_number" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>CoC number</label>
</field>
<field id="whatsapp_number" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="whatsapp_number" translate="label" type="text" sortOrder="20" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>WhatsApp Contact Number</label>
<validate>no-marginal-whitespace</validate>
</field>
<field id="facebook_address" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="facebook_address" translate="label" type="text" sortOrder="110" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Facebook url</label>
<validate>validate-url</validate>
</field>
<field id="twitter_handle" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="twitter_handle" translate="label" type="text" sortOrder="120" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Twitter handle</label>
<validate>no-whitespace</validate>
<tooltip>Enter a valid Twitter handle without the url</tooltip>
</field>
<field id="linkedin_address" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="linkedin_address" translate="label" type="text" sortOrder="130" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>LinkedIn url</label>
<validate>validate-url</validate>
</field>
<field id="instagram_address" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="instagram_address" translate="label" type="text" sortOrder="140" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Instagram url</label>
<validate>validate-url</validate>
</field>
<field id="pinterest_address" translate="label" type="text" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="mastodon_address" translate="label" type="text" sortOrder="150" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Mastodon url</label>
<validate>validate-url</validate>
</field>
<field id="pinterest_address" translate="label" type="text" sortOrder="160" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Pinterest url</label>
<validate>validate-url</validate>
</field>
<field id="youtube_address" translate="label" type="text" sortOrder="200" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>YouTube url</label>
<validate>validate-url</validate>
</field>
<field id="vimeo_address" translate="label" type="text" sortOrder="210" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Vimeo url</label>
<validate>validate-url</validate>
</field>
</group>
</section>

<section id="siteation_storeinfo_extra" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10"
translate="label">
<label>Store Info</label>
<tab>siteation</tab>
<resource>Magento_Backend::store</resource>
<group id="storeinfo_extra" translate="label" sortOrder="110" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>StoreInfo Extra</label>
<comment>(These settings can also be found in General > General > Store Extra Information)</comment>
<field id="coc_number" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>CoC number</label>
<config_path>general/store_information_extra/coc_number</config_path>
</field>
<field id="whatsapp_number" translate="label" type="text" sortOrder="20" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>WhatsApp Contact Number</label>
<validate>no-marginal-whitespace</validate>
<config_path>general/store_information_extra/whatsapp_number</config_path>
</field>
</group>
<group id="storeinfo_extra_socials" translate="label" sortOrder="120" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>StoreInfo Socials</label>
<comment>(These settings can also be found in General > General > Store Extra Information)</comment>
<field id="facebook_address" translate="label" type="text" sortOrder="110" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Facebook url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/facebook_address</config_path>
</field>
<field id="twitter_handle" translate="label" type="text" sortOrder="120" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Twitter handle</label>
<validate>no-whitespace</validate>
<tooltip>Enter a valid Twitter handle without the url</tooltip>
<config_path>general/store_information_extra/twitter_handle</config_path>
</field>
<field id="linkedin_address" translate="label" type="text" sortOrder="130" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>LinkedIn url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/linkedin_address</config_path>
</field>
<field id="instagram_address" translate="label" type="text" sortOrder="140" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Instagram url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/instagram_address</config_path>
</field>
<field id="mastodon_address" translate="label" type="text" sortOrder="150" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Mastodon url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/mastodon_address</config_path>
</field>
<field id="pinterest_address" translate="label" type="text" sortOrder="160" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Pinterest url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/pinterest_address</config_path>
</field>
<field id="youtube_address" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="youtube_address" translate="label" type="text" sortOrder="200" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>YouTube url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/youtube_address</config_path>
</field>
<field id="vimeo_address" translate="label" type="text" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="vimeo_address" translate="label" type="text" sortOrder="210" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Vimeo url</label>
<validate>validate-url</validate>
<config_path>general/store_information_extra/vimeo_address</config_path>
</field>
</group>
</section>
Expand Down
155 changes: 58 additions & 97 deletions view/frontend/templates/hyva/socials.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,104 +11,65 @@ use Siteation\StoreInfoExtra\ViewModel\StoreInfoExtra;
/** @var StoreInfoExtra $storeInfoExtra */

$storeInfoExtra = $viewModels->require(StoreInfoExtra::class);

$socials = [
[
'type' => 'facebook',
'link' => $storeInfoExtra->getFacebook(),
'title' => __('Go to our %1 page', 'Facebook')
],
[
'type' => 'twitter',
'link' => 'https://twitter.com/' . $storeInfoExtra->getTwitter(),
'title' => __('Visit %1 on Twitter for more', $storeInfoExtra->getTwitter())
],
[
'type' => 'linkedin',
'link' => $storeInfoExtra->getLinkedIn(),
'title' => __('Go to our %1 page', 'LinkedIn')
],
[
'type' => 'instagram',
'link' => $storeInfoExtra->getInstagram(),
'title' => __('Explore our %1 page', 'Instagram')
],
[
'type' => 'mastodon',
'link' => $storeInfoExtra->getMastodon(),
'title' => __('Explore our %1 page', 'Mastodon')
],
[
'type' => 'pinterest',
'link' => $storeInfoExtra->getPinterest(),
'title' => __('Explore our %1 page', 'Pinterest')
],
[
'type' => 'youtube',
'link' => $storeInfoExtra->getYouTube(),
'title' => __('Go to our %1 page', 'YouTube')
],
[
'type' => 'vimeo',
'link' => $storeInfoExtra->getVimeo(),
'title' => __('View more on our %1 page', 'Vimeo')
]
];
?>

<div class="socials flex flex-wrap">
<?php if ($social = $storeInfoExtra->getFacebook()): ?>
<a
class="action p-2 facebook"
href="<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('Go to our %1 page', 'Facebook')); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#facebook" />
</svg>
</a>
<?php endif; ?>

<?php if ($social = $storeInfoExtra->getTwitter()): ?>
<a
class="action p-2 twitter"
href="https://twitter.com/<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('Visit %1 on Twitter for more', $social)); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#twitter" />
</svg>
</a>
<?php endif; ?>

<?php if ($social = $storeInfoExtra->getLinkedIn()): ?>
<a
class="action p-2 linkedin"
href="<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('Go to our %1 page', 'LinkedIn')); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#linkedin" />
</svg>
</a>
<?php endif; ?>

<?php if ($social = $storeInfoExtra->getInstagram()): ?>
<a
class="action p-2 instagram"
href="<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('Explore our %1 page', 'Instagram')); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#instagram" />
</svg>
</a>
<?php endif; ?>

<?php if ($social = $storeInfoExtra->getPinterest()): ?>
<a
class="action p-2 pinterest"
href="<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('Explore our %1 page', 'Pinterest')); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#pinterest" />
</svg>
</a>
<?php endif; ?>

<?php if ($social = $storeInfoExtra->getYouTube()): ?>
<a
class="action p-2 youtube"
href="<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('View more on our %1 page', 'YouTube')); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#youtube" />
</svg>
</a>
<?php endif; ?>

<?php if ($social = $storeInfoExtra->getVimeo()): ?>
<a
class="action p-2 vimeo"
href="<?= $escaper->escapeHtml($social); ?>"
target="_blank"
rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<title><?= $escaper->escapeHtml(__('View more on our %1 page', 'Vimeo')); ?></title>
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#vimeo" />
</svg>
</a>
<?php endif; ?>
<?php foreach ($socials as $social): ?>
<?php if ($social['link']): ?>
<a
class="action p-2 <?= $social['type']; ?>"
href="<?= $escaper->escapeHtml($social['link']); ?>"
target="_blank"
rel="noopener noreferrer"
title="<?= $escaper->escapeHtml($social['title']); ?>"
>
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor">
<use href="<?= $block->getViewFileUrl('Siteation_StoreInfoExtra::images/socials.svg'); ?>#<?= $social['type']; ?>" />
</svg>
</a>
<?php endif; ?>
<?php endforeach; ?>
</div>
Loading

0 comments on commit 29331ab

Please sign in to comment.