Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @var \App\Components\IArticleMenuFactory
- * @inject
- */
- public $articleMenuFactory;
- protected function createComponentArticleMenu()
- {
- $this->articleMenuFactory->create();
- }
- Ruční vykreslení zatím s controlem (pokud tam uvedu tu mojí komponentu, tak na mě řve, že nebyla vytvořená)
- {* Latte template *}
- {block content}
- <br /> <br />
- <div id='artIconMenu'></div>
- <div class="main"><h3>Nový článek:</h3> <br />
- {$presenter['addArticle']->render('begin')}
- {if !empty($presenter['addArticle']->errors)}
- <div>
- {foreach $presenter['addArticle']->errors AS $error}
- {$error}<br>
- {/foreach}
- </div>
- {/if}
- <table class='addMenuArt'>
- <tr>
- <td>{$presenter['addArticle']['title']->label}</td>
- <td>{$presenter['addArticle']['title']->control}</td>
- <td>{$presenter['addArticle']['published']->label}</td>
- <td>{$presenter['addArticle']['published']->control}</td>
- <td>{control articleMenu}</td>
- </tr>
- </table>
- <table class='addContentArt'>
- <tr>
- <td>{$presenter['addArticle']['content']->control}</td>
- </tr>
- </table>
- <div>{$presenter['addArticle']['submit']->control}</div>
- {$presenter['addArticle']->render('end')}
- </div>
- {/block}
- ArticleMenu kompomenta (ta co chci zobrazit jednou s buttonkem a jednou bez)
- <?php
- namespace App\Components;
- use Nette\Application\UI\Form;
- class ArticleMenu extends \Nette\Application\UI\Control {
- private $articles;
- public function __construct(\App\Model\Articles $articles) {
- parent::__construct();
- $this->articles = $articles;
- }
- protected function createComponentArticleMenu() {
- $form = new Form();
- $form->addSelect('category','Kategorie', $this->articles->getArticleCategories()->fetchPairs('id', 'name'))
- ->setPrompt('Všechny články');
- $form->addSubmit('addSubmit', 'Zobrazit');
- return $form;
- }
- public function render() {
- $this['articleMenu']->render();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment