PHP Класс Piwik\Widget\Widget

The generated widget will guide you through the creation of a widget. For an example, see {@link https://github.com/piwik/piwik/blob/master/plugins/ExamplePlugin/Widgets/MyExampleWidget.php}
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
configure ( WidgetConfig $config )
render ( ) : string

Защищенные методы

Метод Описание
renderTemplate ( string $template, array $variables = [] ) : string Assigns the given variables to the template and renders it.

Описание методов

configure() публичный статический Метод

public static configure ( WidgetConfig $config )
$config WidgetConfig

render() публичный Метод

public render ( ) : string
Результат string

renderTemplate() защищенный Метод

Example: public function myControllerAction () { return $this->renderTemplate('index', array( 'answerToLife' => '42' )); } This will render the 'index.twig' file within the plugin templates folder and assign the view variable answerToLife to 42.
protected renderTemplate ( string $template, array $variables = [] ) : string
$template string The name of the template file. If only a name is given it will automatically use the template within the plugin folder. For instance 'myTemplate' will result in '@$pluginName/myTemplate.twig'. Alternatively you can include the full path: '@anyOtherFolder/otherTemplate'. The trailing '.twig' is not needed.
$variables array For instance array('myViewVar' => 'myValue'). In template you can use {{ myViewVar }}
Результат string