composer.json
{
"require":{
"kollarovic/admin": "dev-master"
}
}
config.neon
extensions:
navigation: Kollarovic\Navigation\DI\Extension
admin: Kollarovic\Admin\DI\Extension
BasePresenter
namespace App\BackendModule\Presenters;
use Nette\Application\UI\Presenter;
use Kollarovic\Admin\IAdminControlFactory;
abstract class BasePresenter extends Presenter
{
/** @var IAdminControlFactory @inject */
public $adminControlFactory;
protected function createComponentAdminControl()
{
$adminControl = $this->adminControlFactory->create();
return $adminControl;
}
}
@layout.latte
{capture $content}
{include content}
{/capture}
{control adminControl content=>$content}
SignPresenter
namespace App\BackendModule\Presenters;
use Kollarovic\Admin\ILoginControlFactory;
use Nette\Application\UI\Presenter;
class SignPresenter extends Presenter
{
/** @var ILoginControlFactory @inject */
public $loginControlFactory;
protected function createComponentLoginControl()
{
$loginControl = $this->loginControlFactory->create();
$loginControl->onLoggedIn[] = function() {
$this->redirect('Homepage:default');
};
return $loginControl;
}
}
in.latte
{control loginControl}