Beispiel #1
0
 /**
  * Renders a nest with a anonymous function in the middle.
  *
  * @param Model $model
  *   The model, which hosts all the data we need.
  * @param bool $isExpanded
  *   The only expanded nest is the settings menu, when we render only the
  *   settings menu.
  *
  * @return string
  *   The generated markup from the template files.
  */
 public function renderNest(Model $model, $isExpanded = false)
 {
     $template = $this->getTemplateFileContent('nest');
     // Replace our stuff in the partial.
     $domid = '';
     if (strlen($model->getDomid())) {
         $domid = 'id="' . $model->getDomid() . '"';
     }
     $template = str_replace('{domId}', $domid, $template);
     // Are we expanding this one?
     if ($isExpanded) {
         $style = '';
     } else {
         $style = 'khidden';
     }
     $template = str_replace('{style}', $style, $template);
     return str_replace('{mainfunction}', $model->renderMe(), $template);
 }