You are here

public function WebformThemeManager::render in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformThemeManager.php \Drupal\webform\WebformThemeManager::render()

Renders HTML given a structured array tree.

Parameters

array $elements: The structured array describing the data to be rendered.

bool $default_theme: Render using the default theme. Defaults to TRUE.

Return value

\Drupal\Component\Render\MarkupInterface The rendered HTML.

Overrides WebformThemeManagerInterface::render

File

src/WebformThemeManager.php, line 173

Class

WebformThemeManager
Defines a class to manage webform theming.

Namespace

Drupal\webform

Code

public function render(array &$elements, $theme_name = NULL) {
  if ($theme_name !== NULL) {
    $this
      ->setCurrentTheme($theme_name);
  }
  $markup = $this->renderer
    ->render($elements);
  if ($theme_name !== NULL) {
    $this
      ->setActiveTheme();
  }
  return $markup;
}