Class humhub\components\rendering\DefaultViewPathRenderer

Inheritancehumhub\components\rendering\DefaultViewPathRenderer » humhub\components\rendering\ViewPathRenderer » yii\base\BaseObject
Implementshumhub\components\rendering\Renderer
Subclasseshumhub\components\rendering\MailRenderer, humhub\modules\notification\renderer\MailRenderer, humhub\modules\notification\renderer\WebRenderer
Available since version1.2

The DefaultViewPathRenderer is used to render Viewables.

This Renderer can provide a $defaultView and $defaultViewPath which will be used in case the view file could not be determined by means of the viewName property of the Viewable.

The DefaultViewPathRenderer will search for a view file in the given order (without $parent and $subPath settings):

  • Search for the view relative to the Viewable class

[ViewableClassPath]/views/[viewName].php

  • Search for the view within the $defaultViewPath (if given):

defaultViewPath/[viewName].php

  • Use the $defaultView.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$defaultView string Fallback view humhub\components\rendering\DefaultViewPathRenderer
$defaultViewPath string Fallback view path humhub\components\rendering\DefaultViewPathRenderer
$parent boolean If set to true the renderer will search in the parents view directory for the view. humhub\components\rendering\ViewPathRenderer
$subPath string A subpath within the view folder used for searching the view e. humhub\components\rendering\ViewPathRenderer
$viewPath string View path humhub\components\rendering\ViewPathRenderer

Public Methods

Hide inherited methods

MethodDescriptionDefined By
getViewFile() Returns the view file for the given Viewable. humhub\components\rendering\DefaultViewPathRenderer
getViewPath() Returns the directory containing the view files for this event. humhub\components\rendering\ViewPathRenderer
render() Renders the viewable by searching the viewable's viewName within the given viewPath. humhub\components\rendering\ViewPathRenderer
renderView() Helper function for rendering a Viewable with the given viewParams. humhub\components\rendering\ViewPathRenderer

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
suffix() Checks if the given $viewName has a file suffix or not. humhub\components\rendering\ViewPathRenderer

Property Details

$defaultView public property

Fallback view

public string $defaultView null
$defaultViewPath public property

Fallback view path

public string $defaultViewPath null

Method Details

getViewFile() public method

Returns the view file for the given Viewable.

If there was no relative view file found, this function will search for the view file within the $defaultPath or return the $defaultView at last resort.

public string getViewFile ( humhub\components\rendering\Viewable $viewable )
$viewable \humhub\modules\notification\components\Viewable
return string

View file of this notification