Inhaltsverzeichnis

Controllers

Camel Case wird in Bindestrich und Kleinbuchstaben umgewandelt

Action

Funktion action<WHAT> bildet die Seite WHAT

Behaviors

    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::class,
                'only' => ['logout'],
                'rules' => [
                    [
                        'actions' => ['logout'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],
            // verbs beziehen sich auf Aktionen
            'verbs' => [ 
                // Filter blockieren Requests basierend auf bestimmten Parameter oder verändern die Response.
                'class' => VerbFilter::class, 
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

Layout anpassen

public function actionWhatever()
{
    $this->layout = 'whatever'; // benutzt view/layouts/whatever.php als layout anstelle von main.php
}

Nested Layout

Untergeordnete Ebene
<?php
...
AppAsset::register($this);
$this->beginContent(viewFile: '@path/to/base.php');
?>
<div>
    <?php echo $this->render(view: 'main');
</div>
<?php $this->endContent();