Normally a widget is used by calling CController::widget()
on an instance of CController
, typically $this
in a view.
But if I'm writing a static method, a helper, say, then I don't have access to an instance of CController
. So how do I use a widget?
Let's say further that this helper method is invoked in the eval()
’ed expression in a CDataColumn
's value
property. That poor expression has almost no context at all. How should the helper use a widget?
EDIT: Code example
As requested, a view example:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $model->search(),
'columns' => array(
array(
'name' => 'attrName',
'value' => '--USE WIDGET HERE--',
),
)
));