Skip to content

Commit

Permalink
Dev: Plugins can use $this->renderPartial to render views
Browse files Browse the repository at this point in the history
Dev: Views must be stored in views/ folder
  • Loading branch information
olleharstedt committed Jul 25, 2016
1 parent fb885c6 commit dda8da1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions application/libraries/PluginManager/PluginBase.php
Expand Up @@ -290,6 +290,20 @@ protected function getDir()
return dirname($fileName);
}

/**
* Look for views in plugin views/ folder and render it (no echo)
*
* @param string $viewfile Filename of view in views/ folder
* @param array $data
* @return string;
*/

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Jul 25, 2016

Collaborator

Why not :
renderPartial($viewfile, $data,$return=false,$processOutput=false) like Yii ? (or return=true if you really want to set it to defaut)

public function renderPartial($viewfile, $data)
{
$alias = 'plugin_views_folder' . $this->id;
\Yii::setPathOfAlias($alias, $this->getDir());
return \Yii::app()->controller->renderPartial($alias .'.views.' . $viewfile, $data, true);
}

/**
* Translation for plugin
*
Expand Down

0 comments on commit dda8da1

Please sign in to comment.