Last active
January 12, 2017 16:52
-
-
Save eS-IT/8482b702777e639da46c9ba319c1d58d to your computer and use it in GitHub Desktop.
Contao 4: Dependency Injection - AcmeElement.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AcmeElement extends \ContentElement | |
{ | |
/** | |
* Template | |
* @var string | |
*/ | |
protected $strTemplate = 'ce_esit_default'; | |
/** | |
* Generate the content element | |
*/ | |
protected function compile() | |
{ | |
if (TL_MODE == 'BE') { | |
$this->strTemplate = 'be_wildcard'; | |
$this->Template = new \BackendTemplate($this->strTemplate); | |
$this->Template->wildcard = "### AcmeElement ###"; | |
} else { | |
$greeter = \Contao\System::getContainer()->get('acme_test.greeter'); | |
$greeter->greet(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment