Skip to content

Instantly share code, notes, and snippets.

@eS-IT
eS-IT / entity_basics-AcmeElement.php
Created January 12, 2017 17:06
Contao 4: Entity-Grundlagen - AcmeElement.php
<?php
class AcmeElement extends \ContentElement
{
/**
* Template
* @var string
*/
protected $strTemplate = 'ce_esit_default';
/**
@eS-IT
eS-IT / entity_basics-template.html
Created January 12, 2017 17:07
Contao 4: Entity-Grundlagen - template.html
<div class="plz">
<?php echo $this->plz->getPostal(); ?> -
<?php echo $this->plz->getCity(); ?> -
<?php echo $this->plz->getCountry(); ?>
</div>
@eS-IT
eS-IT / erweiterung_bundle-tree.sh
Created January 12, 2017 17:09
Contao 4: Erweiterung als Bundle - tree.sh
src/
└── Acme
└── TestBundle
├── classes
│   └── contao
│      └── elements
└── Resources
└── contao
├── config
├── language
@eS-IT
eS-IT / erweiterung_bundle-AppKernel.php
Created January 12, 2017 17:10
Contao 4: Erweiterung als Bundle - AppKernel.php
<?php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new Acme\TestBundle\AcmeTestBundle()
];
@eS-IT
eS-IT / erweiterung_bundle-config.php
Created January 12, 2017 17:11
Contao 4: Erweiterung als Bundle - config.php
<?php
#/src/Acme/TestBundle/Resources/contao/config/config.php
$GLOBALS['TL_CTE']['acme']['testelement'] = '\Acme\TestBundle\classes\contao\elements\TestElement';
@eS-IT
eS-IT / erweiterung_bundle-ce_testelement.html
Created January 12, 2017 17:12
Contao 4: Erweiterung als Bundle - ce_testelement.html
#/src/Acme/TestBundle/Resources/contao/templates/ce_testelement.html
<div class="testelement">
<?php echo $this->content; ?>
</div>
@eS-IT
eS-IT / erweiterung_bundle-TestElement.php
Created January 12, 2017 17:13
Contao 4: Erweiterung als Bundle - TestElement.php
<?php
namespace Acme\TestBundle\classes\contao\elements;
class TestElement extends \ContentElement
{
protected $strTemplate = 'ce_testelement';
protected function compile()
{
if (TL_MODE == 'BE') {
@eS-IT
eS-IT / dca.php
Last active December 7, 2019 09:50
contao_dca_Text
<?php
'mytext' => [
'label' => &$GLOBALS['TL_LANG'][$table]['mytext'],
'exclude' => true,
'sorting' => true,
'inputType' => 'text',
'eval' => ['maxlength'=>255, 'tl_class'=>'w50'],
'sql' => "varchar(255) NOT NULL default ''"
]
@eS-IT
eS-IT / dca.php
Last active December 7, 2019 11:15
contao_dca_Passwort
<?php
'mypassword' => [
'label' => &$GLOBALS['TL_LANG'][$table]['mypassword'],
'exclude' => true,
'inputType' => 'password',
'eval' => ['mandatory'=>true, 'preserveTags'=>true, 'minlength'=>\Contao\Config::get('minPasswordLength')],
'sql' => "varchar(128) NOT NULL default ''"
]
@eS-IT
eS-IT / dca.php
Last active December 7, 2019 10:30
contao_dca_Textarea
<?php
'mytextarea' => [
'label' => &$GLOBALS['TL_LANG'][$table]['mytextarea'],
'exclude' => true,
'search' => true,
'inputType' => 'textarea',
'eval' => ['rte'=>'tinyMCE', 'tl_class'=>'clr'],
'sql' => 'text NOT NULL'
]