nattreid / web-manager
Web Manager for CMS
1.7.17
2023-08-09 08:21 UTC
Requires
- php: >= 7.1
- nattreid/cms: ~1.0
- nattreid/gallery: ~2.0
Requires (Dev)
- nette/tester: ~2.2
- tracy/tracy: ~2.6
- dev-master / 1.x-dev
- 1.7.17
- 1.7.16
- 1.7.15
- 1.7.14
- 1.7.13
- 1.7.12
- 1.7.11
- 1.7.10
- 1.7.9
- 1.7.8
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.0
- 1.6.14
- 1.6.13
- 1.6.12
- 1.6.11
- 1.6.10
- 1.6.9
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.35
- 1.5.34
- 1.5.33
- 1.5.32
- 1.5.31
- 1.5.30
- 1.5.29
- 1.5.28
- 1.5.27
- 1.5.26
- 1.5.25
- 1.5.24
- 1.5.23
- 1.5.22
- 1.5.21
- 1.5.20
- 1.5.19
- 1.5.18
- 1.5.17
- 1.5.16
- 1.5.15
- 1.5.14
- 1.5.13
- 1.5.12
- 1.5.11
- 1.5.10
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-dev-1.x
This package is auto-updated.
Last update: 2024-12-09 11:07:04 UTC
README
Nastavení
Přidat extension do config.neon
extensions: webManager: NAttreid\WebManager\DI\WebManagerExtension webManager: homepage: 'Homepage:default' page: 'Homepage:page' onePage: 'Homepage:onePage' module: 'Front' gallery: # nastaveni galerie maxFileSize: 5 #MB maxFiles: 20
Pages
Nastavte HomepagePresenter
class HomepagePresenter extendes Presenter { public $locale; /** @var \NAttreid\WebManager\Services\PageService @inject */ public $pageService; public function actionPage($url) { $page = $this->pageService->getPage($url, $this->locale); // stranku date do template pro zobrazeni $this->template->page = $page; }
a upravte router
class FrontRouter extends Router { /** @var \NAttreid\WebManager\Services\PageService */ private $pageService; public function __construct($url, \NAttreid\WebManager\Services\PageService $pageService) { parent::__construct($url); $this->pageService = $pageService; } public function createRoutes() { $routes = $this->getRouter('Front'); $this->pageService->createRoute($routes, $this->getUrl()); // nebo pokud je treba vlozit route mezi routy stranky a defaultni strankou $this->pageService->createPageRoute($routes, $this->getUrl()); $routes[] = new Route(...); $this->pageService->createDefaultPageRoutes($routes, $this->getUrl()); } }
Content
class HomepagePresenter extendes Presenter { public $locale; /** @var \NAttreid\WebManager\Service @inject */ public $webManager; public function actionPage($url) { $content = $this->webManager->getContent('main', $this->locale); // stranku date do template pro zobrazeni $this->template->content = $content; }
Hooks
class SomeHook extends \NAttreid\WebManager\Services\Hooks\HookFactory { /** @var IConfigurator */ protected $configurator; public function create(): Component { $form = $this->formFactory->create(); $form->setAjaxRequest(); $form->addText('id', 'webManager.web.hooks.some.clientId') ->setDefaultValue($this->configurator->someId); $form->addSubmit('save', 'form.save'); $form->onSuccess[] = [$this, 'someFormSucceeded']; return $form; } public function someFormSucceeded(Form $form, $values) { $this->configurator->someId = $values->id; $this->flashNotifier->success('default.dataSaved'); } // nebo DataGrid public function create(): Component { $form = $this->formFactory->create(); $form->setAjaxRequest(); $form->addText('id', 'webManager.web.hooks.some.clientId') ->setDefaultValue($this->configurator->someId); $form->addSubmit('save', 'form.save'); $form->onSuccess[] = [$this, 'someFormSucceeded']; return $form; } public function someFormSucceeded(Form $form, $values) { $this->configurator->someId = $values->id; $this->flashNotifier->success('default.dataSaved'); } }
A třídu zaregistrovat jako službu a načte se automaticky do CMS