You are here

protected function InsertFileWidgetUtility::render in Insert 8

Returns the rendered template for a specific style or pseudo-style.

Parameters

string $styleName:

array $vars:

Return value

string

1 call to InsertFileWidgetUtility::render()
InsertFileWidgetUtility::process in src/Utility/InsertFileWidgetUtility.php
Form API callback: Processes a file field element.
1 method overrides InsertFileWidgetUtility::render()
InsertImageWidgetUtility::render in src/Utility/InsertImageWidgetUtility.php
@inheritdoc

File

src/Utility/InsertFileWidgetUtility.php, line 386

Class

InsertFileWidgetUtility

Namespace

Drupal\insert\Utility

Code

protected function render($styleName, $vars) {
  if ($styleName == 'icon_link') {
    $rendered = \Drupal::theme()
      ->render([
      'insert_icon_link',
    ], $vars);
  }
  elseif ($styleName === 'link') {
    $rendered = \Drupal::theme()
      ->render([
      'insert_link',
    ], $vars);
  }
  else {
    return '';
  }
  return gettype($rendered) === 'string' ? $rendered : $rendered
    ->jsonSerialize();
}