Fix HTML rendering for vendor notes links

Add proper HTML filtering to render mailto links and formatting in vendor notes.

- Create HtmlArraySerialized backend model to prevent HTML escaping
- Add filterOutputHtml() method to safely render HTML content
- Update template to use HTML filtering
- Decode HTML entities before display
This commit is contained in:
shopkeeperdev
2025-10-07 19:03:16 -04:00
parent fcc8697c75
commit 9d6112b703
4 changed files with 39 additions and 3 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Shopkeeper\VendorNotes\Model\Config\Backend;
use Magento\Config\Model\Config\Backend\Serialized\ArraySerialized;
class HtmlArraySerialized extends ArraySerialized
{
/**
* Process data before saving
* Prevent HTML from being escaped in note fields
*
* @return $this
*/
public function beforeSave()
{
$value = $this->getValue();
if (is_array($value)) {
// Don't escape HTML in the note field
foreach ($value as &$row) {
if (isset($row['note'])) {
// Decode any previously encoded HTML entities
$row['note'] = html_entity_decode($row['note'], ENT_QUOTES, 'UTF-8');
}
}
unset($row);
}
$this->setValue($value);
return parent::beforeSave();
}
}