Question

I have created a simple crud module that renders form with a few basic fields and saves data into database. Module is working fine and saving data correctly in the database.

Issue is before rendering form value I want to add a prefix to URL, something like this.

public function getInstagramLink()
{
    return 'https:'.$this->getData('instagram_link');
}

I have added this method within Model but that doesn't seem to be working

namespace Vendor\Module\Model;

class Instalocator extends \Magento\Framework\Model\AbstractModel
{
    protected function _construct()
    {
        $this->_init(\Vendor\Module\Model\ResourceModel\Instalocator ::class);
    }

    public function getInstagramLink()
    {
        return 'https:'.$this->getData('instagram_link');
    }
}

This doesn't seem to be working. How to do this correctly to set/get value before/after saving into database?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top