On gists
Automatické vytvoření komponenty s @autowiringem // AW
Nette-Controls
Nette-Tricks
AW
auto-create.php
Raw
#
<?php
public function createComponentOrderReview()
{
return $this->getPresenter()->getControlFactory()->create($this, 'orderReview', [
'order' => $this->getOrder()
]);
}
// from same category
public function createComponentSameCategoryProducts()
{
$config = $this->getCurrentConfig();
$product = $this->getProduct();
$component = parent::createComponent($config['category_list_component']);
$component->setConfig([
'except_ids' => [
$product::INHERITED ? $product->product_id : $product->id,
$product->item__product_id,
$product->inherit__product_id
],
'navigation_id' => $product->getMainCat()->id,
'default_filter' => []
]);
return $component;
}