protected function compile()
	{
		$this->text = StringUtil::toHtml5($this->text);

		// Add the static files URL to images
		if ($staticUrl = System::getContainer()->get('contao.assets.files_context')->getStaticUrl())
		{
			$path = Config::get('uploadPath') . '/';
			$this->text = str_replace(' src="' . $path, ' src="' . $staticUrl . $path, $this->text);
		}

		$this->Template->text = StringUtil::encodeEmail($this->text);
		$this->Template->addImage = false;

		// Add an image
		if ($this->addImage && $this->singleSRC != '')
		{
			$objModel = FilesModel::findByUuid($this->singleSRC);

			if ($objModel !== null && is_file(System::getContainer()->getParameter('kernel.project_dir') . '/' . $objModel->path))
			{
				$this->singleSRC = $objModel->path;
				$this->addImageToTemplate($this->Template, $this->arrData, null, null, $objModel);
			}
		}
	}
protected function compile()
	{
		$this->text = StringUtil::toHtml5($this->text);

		
		if ($staticUrl = System::getContainer()->get('contao.assets.files_context')->getStaticUrl())
		{
			$path = Config::get('uploadPath') . '/';
			$this->text = str_replace(' src="' . $path, ' src="' . $staticUrl . $path, $this->text);
		}

		$this->Template->text = StringUtil::encodeEmail($this->text);
		$this->Template->addImage = false;

		
		if ($this->addImage && $this->singleSRC != '')
		{
			$objModel = FilesModel::findByUuid($this->singleSRC);

			if ($objModel !== null && is_file(System::getContainer()->getParameter('kernel.project_dir') . '/' . $objModel->path))
			{
				$this->singleSRC = $objModel->path;
				$this->addImageToTemplate($this->Template, $this->arrData, null, null, $objModel);
			}
		}
	}
protected function compile ( ) { $ this -> text = StringUtil :: toHtml5 ( $ this -> text ) ; // Add the static files URL to images if ( $ staticUrl = System :: getContainer ( ) -> get ( 'contao.assets.files_context' ) -> getStaticUrl ( ) ) { $ path = Config :: get ( 'uploadPath' ) . '/' ; $ this -> text = str_replace ( ' src="' . $ path , ' src="' . $ staticUrl . $ path , $ this -> text ) ; } $ this -> Template -> text = StringUtil :: encodeEmail ( $ this -> text ) ; $ this -> Template -> addImage = false ; // Add an image if ( $ this -> addImage && $ this -> singleSRC != '' ) { $ objModel = FilesModel :: findByUuid ( $ this -> singleSRC ) ; if ( $ objModel !== null && is_file ( System :: getContainer ( ) -> getParameter ( 'kernel.project_dir' ) . '/' . $ objModel -> path ) ) { $ this -> singleSRC = $ objModel -> path ; $ this -> addImageToTemplate ( $ this -> Template , $ this -> arrData , null , null , $ objModel ) ; } } }
Generate the content element
Generate the content element