$this->addField('name', 'Text', __('Nom'), ['column' => true]);
+ $this->addField('preview', 'NoValue', __('Preview'), ['column' => true, 'column_type' => 'model_function', 'column_function_name' => 'getPreviewImage', 'column_limit' => -1]);
+
$this->setSettingsFields();
}
public function setSettingsFields()
{
+
$this->addField([
'name' => 'section_fonts',
'type' => 'FormSection',
$str = str_replace("s:8:\"\0*\0datas\"", 's:5:"datas"', $str);
return unserialize($str);
}
+
+ public function getPreviewImage()
+ {
+ return '<img src="data:image/jpeg;base64,' . base64_encode(file_get_contents(storage_path('/themes/' . $this->getIdValue() . '.jpg'))) . '" width="200" height="140" alt="" />';
+ }
}