ArraySerialized.php 522 Bytes
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php

namespace Dotdigitalgroup\Email\Model\Config\Backend;

class ArraySerialized extends \Dotdigitalgroup\Email\Model\Config\Backend\Serialized
{
    /**
     * Unset array element with '__empty' key
     *
     * @return \Dotdigitalgroup\Email\Model\Config\Backend\Serialized
     */
    public function beforeSave()
    {
        $value = $this->getValue();
        if (is_array($value)) {
            unset($value['__empty']);
        }
        $this->setValue($value);

        return parent::beforeSave();
    }
}