Fixed location of 'Model' directory
This commit is contained in:
32
Model/Config/Backend/HtmlArraySerialized.php
Normal file
32
Model/Config/Backend/HtmlArraySerialized.php
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user