Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build
src/Widgets
tests
.gitattributes
.gitignore
.travis.yml
build.xml
composer.json
license.md
readme.md
venne-phing.xml

readme.md

Venne:Widgets Build Status

Installation

The best way to install Venne/Widgets is using Composer:

composer require venne/widgets:@dev

Automatic usage

Register widgets

Use tag venne.widget:

services:
	myControlFactory:
		class: App\MyControlFactory
		tags: [venne.widget: 'myWidget']

Use widgets in presenters/controls as global component

class ExamplePresenter extends Nette\Application\UI\Presenter
{
	use Venne\Widgets\WidgetsControlTrait;
}

Template:

...
{control myWidget}
...

Manual usage

Register some widgets

$widgetManager = new Venne\Widgets\WidgetManager($systemContainer);
$widgetManager->addWidget('widget1', function() {
	return new MyComponent;
});
$widgetManager->addWidget('widget2', new MyFormFactory);
$widgetManager->addWidget('widget3', 'app.myFormFactory'); // service in system container

Create instance and use it

if ($widgetManager->hasWidget('widget1')) {
	$widget = $widgetManager->getWidget('widget1');
	$widget->render();
}
You can’t perform that action at this time.