Skip to content

Commit

Permalink
Fix: social custom link
Browse files Browse the repository at this point in the history
  • Loading branch information
phutx committed Oct 24, 2023
1 parent a1b29eb commit 200e95d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Model/Config/Backend/ValidUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 42,7 @@ public function beforeSave()
$this->getValue()
?? ''));
foreach ($valueArray as $value) {
$value = explode(',', $value);
if (!filter_var($value[0], FILTER_VALIDATE_URL)) {
if (!filter_var($value, FILTER_VALIDATE_URL)) {
throw new ValidatorException(__('Invalid url format.'));
}
}
Expand Down
7 changes: 1 addition & 6 deletions Plugin/SeoRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -1008,16 1008,11 @@ public function getSocialProfiles()
}
}
if ($this->helperData->getSocialProfiles('custom_link')) {
$customLink = [];
$valueArray = array_map('trim', explode(
"\n",
$this->helperData->getSocialProfiles('custom_link')
?? ''));
foreach ($valueArray as $value) {
$value = explode(',', $value);
$customLink[] = $value[0];
}
$lines = array_merge($lines, $customLink);
$lines = array_merge($lines, $valueArray);
}

return $lines;
Expand Down
4 changes: 2 additions & 2 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 295,8 @@
<backend_model>Mageplaza\Seo\Model\Config\Backend\ValidUrl</backend_model>
<comment><![CDATA[- List of Social Profile Links separated by commas to add to Social Profile.<br>- One link per line.
<br>Example:
<br>https://www.pinterest.com/,Pinterest
<br>https://www.amazon.com/,Amazon]]></comment>
<br>https://www.pinterest.com/
<br>https://www.amazon.com/]]></comment>
</field>
</group>
<group id="verification" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
Expand Down

0 comments on commit 200e95d

Please sign in to comment.