Skip to content

Commit

Permalink
Dev: Add renderTwig() from dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jun 6, 2018
1 parent 091be5a commit e8766de
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions application/libraries/PluginManager/LimesurveyApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,20 @@ public function pluginIsActive($name)
}
}

/**
* @param string $file
* @param array $data
* @return string
*/
public function renderTwig($file, array $data)
{
return Yii::app()->twigRenderer->renderViewFromFile(
$file,
$data,
// Don't echo.
true,
// Don't append application dir.
false
);
}
}

?>

6 comments on commit e8766de

@Shnoulle
Copy link
Collaborator

@Shnoulle Shnoulle commented on e8766de Jun 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/ but i add

public function renderPartial($twigView,$aData)
for such purpose ;)

API need some update, for example Expression is totally broken : must have more option , here why disable return and app dir ?

@olleharstedt
Copy link
Collaborator Author

@olleharstedt olleharstedt commented on e8766de Jun 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yes, happens when we have two branches. :D Let's discuss it later.

@olleharstedt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, yes, guess we could enable the last two arguments, too.

@Shnoulle
Copy link
Collaborator

@Shnoulle Shnoulle commented on e8766de Jun 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to update API, i never use

public function EMevaluateExpression($expression)
for example, because can not send temp value.

I only use

public function newModel(iPlugin $plugin, $sTableName, $scenario = 'insert', $bPluginTable = true)
for table creation etc …

Since we don't update Yii before a long time : i think Yii api is stable ;)

PS : the 2 ssyetm seem different : mine use public template, your‘s no template

@olleharstedt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if there's a difference maybe we could write it down in the PHPDoc sections of the methods?

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yours, mine : i need to add « Using the current information provided by public template » or something like this

But with yours : you can use it with current template ;).

PS : maybe i must remove the .twig ?

Please sign in to comment.