Skip to content

Commit

Permalink
Merge pull request #22 from sprankhub/patch-1
Browse files Browse the repository at this point in the history
Respect comment type, fixes #20
  • Loading branch information
avstudnitz committed Jan 14, 2022
2 parents bf0aa10 + 7840859 commit 7e86132
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Plugin/ConfigFieldPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Magento\Config\Model\Config\Structure\Element\Field as Subject;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Phrase;
use Magento\Store\Api\WebsiteRepositoryInterface;
use Magento\Store\Api\StoreRepositoryInterface;
use Magento\Store\Api\Data\WebsiteInterface;
Expand Down Expand Up @@ -75,10 +76,22 @@ public function afterGetTooltip(Subject $subject, $result)
*/
public function afterGetComment(Subject $subject, $result)
{
$resultIsPhrase = $result instanceof Phrase;
if ($resultIsPhrase) {
$phrase = $result;
$result = $phrase->getText();
$arguments = $phrase->getArguments();
}

if (strlen(trim($result))) {
$result .= '<br />';
}
$result .= __('Path: <code>%1</code>', $this->getPath($subject));

if ($resultIsPhrase) {
$result = new Phrase($result, $arguments);
}

return $result;
}

Expand Down Expand Up @@ -130,4 +143,4 @@ private function getScopeHint($path, $scopeType, $scope)
}
return $scopeLine;
}
}
}

0 comments on commit 7e86132

Please sign in to comment.