/** * AbstractContentElement constructor. * * @param Model|Collection|Result $model Object model or result. * @param TemplateFactory $templateFactory Template factory. * @param string $column Column. * * @throws InvalidArgumentException When model does not have a row method. */ public function __construct($model, TemplateFactory $templateFactory, $column = 'main') { if ($model instanceof Collection) { $model = $model->current(); } if ($model instanceof Model) { $this->model = $model; } Assert::methodExists($model, 'row'); $this->templateFactory = $templateFactory; $this->column = $column; $this->data = $this->deserializeData($model->row()); if ($this->get('customTpl') != '' && TL_MODE == 'FE') { $this->setTemplateName($this->get('customTpl')); } }