ViewRenderer
API reference › yii › base › ViewRenderer
ViewRenderer is the base class for view renderer classes.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$behaviors read-only | array<Behavior<static>> | List of behaviors attached to this component. | Component |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | BaseObject |
__call() | Calls the named method which is not a class method. | Component |
__clone() | This method is called after the object is created by cloning an existing one. | Component |
__get() | Returns the value of a component property. | Component |
__isset() | Checks if a property is set, i.e. defined and not null. | Component |
__set() | Sets the value of a component property. | Component |
__unset() | Sets a component property to be null. | Component |
attachBehavior() | Attaches a behavior to this component. | Component |
attachBehaviors() | Attaches a list of behaviors to the component. | Component |
behaviors() | Returns a list of behaviors that this component should behave as. | Component |
canGetProperty() | Returns a value indicating whether a property can be read. | Component |
canSetProperty() | Returns a value indicating whether a property can be set. | Component |
className() static | Returns the fully qualified name of this class. | BaseObject |
detachBehavior() | Detaches a behavior from the component. | Component |
detachBehaviors() | Detaches all behaviors from the component. | Component |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | Component |
getBehavior() | Returns the named behavior object. | Component |
getBehaviors() | Returns all behaviors attached to this component. | Component |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | Component |
hasMethod() | Returns a value indicating whether a method is defined. | Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | Component |
init() | Initializes the object. | BaseObject |
off() | Detaches an existing event handler from this component. | Component |
on() | Attaches an event handler to an event. | Component |
render() abstract | Renders a view file. | ViewRenderer |
trigger() | Triggers an event. | Component |
Method details
Section titled “Method details”render()
Section titled “render() ”abstract public function render(yii\base\View $view, string $file, array $params): stringRenders a view file.
This method is invoked by View whenever it tries to render a view.
Child classes must implement this method to render the given view file.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | View | The view object used for rendering the file. |
$file | string | The view file. |
$params | array | The parameters to be passed to the view file. |
Returns
string: The rendering result