Download the PHP package evgeniy-it/widget-bundle without Composer
On this page you can find all versions of the php package evgeniy-it/widget-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download evgeniy-it/widget-bundle
More information about evgeniy-it/widget-bundle
Files in evgeniy-it/widget-bundle
Package widget-bundle
Short Description WidgetBundle is something similar to modx snippets, makes your content managment system powerful.
License MIT
Informations about the package widget-bundle
Widget Bundle
Widget bundle is something similar to modx snippets, makes your content managment system powerful.
Installation
With composer:
Widget will be ready to work
Getting started
Render widget via such a shortcode:
Widget also can be nested multiple times:
For parsing and rendering use twig widget filter, it will find all widgets, parse and process them:
Be sure about widget syntax:
- widget name must be ended with ?
- any option must start with &
- any option value must be wrapped in `
- a widget must be started with [[ and ends with ]]
Using:
Default widgets:
Simple widget
This widget just renders setting variables into specified template. If template is not specified it will render only option &content
.
You can specify template as well. Specify template whether as a link or as a string..
Example:
Using default template:
or nested
Will output:
Using custom template:
or
Will output:
Repository widget
Renders collection of doctrine models
Params:
- tpl - one item element template
- model - entity model class
- function - function that will be called
- args - function args. json format
other params:
- beforeTpl - contents piece of code that is being shown before item code structure
- afterTpl - contents piece of code that is being shown after item code structure
in the specified template will be available those vars:
- item - fetched entity model
- idx (int) - ordinal Number
- isFirst (bool) - if the element is the first
- isLast (bool) - if it's the last element
Example:
will output: