You are here

public static function InstapageCmsPluginViewModel::get in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginViewModel.php \InstapageCmsPluginViewModel::get()

Sets variables for the selected template and renders it.

Parameters

string $template Template to render.:

array $variables Variables to be set as template attributes.:

Return value

string Rendered template content.

1 call to InstapageCmsPluginViewModel::get()
InstapageCmsPluginViewModel::_ in core/models/InstapageCmsPluginViewModel.php
Gets the template variable.

File

core/models/InstapageCmsPluginViewModel.php, line 151

Class

InstapageCmsPluginViewModel
Class responsible for displaying a template files.

Code

public static function get($template, $variables = null) {
  $view = new View($template);
  if ($variables) {
    foreach ($variables as $key => $value) {
      $view->{$key} = $value;
    }
  }
  return $view
    ->fetch();
}