Contao\ContentElement::__construct PHP Method

__construct() public method

Initialize the object
public __construct ( ContentModel $objElement, string $strColumn = 'main' )
$objElement ContentModel
$strColumn string
    public function __construct($objElement, $strColumn = 'main')
    {
        if ($objElement instanceof Model || $objElement instanceof Model\Collection) {
            /** @var ContentModel $objModel */
            $objModel = $objElement;
            if ($objModel instanceof Model\Collection) {
                $objModel = $objModel->current();
            }
            $this->objModel = $objModel;
        }
        parent::__construct();
        $this->arrData = $objElement->row();
        $this->cssID = \StringUtil::deserialize($objElement->cssID, true);
        if ($this->customTpl != '' && TL_MODE == 'FE') {
            $this->strTemplate = $this->customTpl;
        }
        $arrHeadline = \StringUtil::deserialize($objElement->headline);
        $this->headline = is_array($arrHeadline) ? $arrHeadline['value'] : $arrHeadline;
        $this->hl = is_array($arrHeadline) ? $arrHeadline['unit'] : 'h1';
        $this->strColumn = $strColumn;
    }

Usage Example

 /**
  * Initialize the content element
  * @param object
  */
 public function __construct($objElement)
 {
     parent::__construct($objElement);
 }
All Usage Examples Of Contao\ContentElement::__construct