Closed dot319 closed 2 years ago
For example, the following resolves the issue for me:
public function afterGetComment(Subject $subject, $result)
{
if ($result instanceof \Magento\Framework\Phrase) {
$phrase = $result;
$result = $phrase->getText();
$arguments = $phrase->getArguments();
}
if (strlen(trim($result))) {
$result .= '<br />';
}
$result .= __('Path: <code>%1</code>', $this->getPath($subject));
if (isset($phrase)) {
$result = new \Magento\Framework\Phrase(
$result,
$arguments
);
}
return $result;
}
\AvS\ScopeHint\Plugin\ConfigFieldPlugin::afterGetComment is currently assuming that $result is a string. Actually, it may be a string or a /Magento/Framework/Phrase. Can you update the codebase so that the method returns a Phrase if it receives a phrase? Currently this module is breaking our admin panel, since in \Magento\SharedCatalog\Block\Adminhtml\System\Config\WebsiteRestriction\IsActive::prepareComment the method getText() is called on the result of this method, throwing an error because it's converted from a Phrase to a string in the plugin.