You are here

public function WebformOptionsCustom::getTemplate in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/Entity/WebformOptionsCustom.php \Drupal\webform_options_custom\Entity\WebformOptionsCustom::getTemplate()

Set a custom options element HTML/SVG template.

Return value

string A custom options element HTML/SVG template.

Overrides WebformOptionsCustomInterface::getTemplate

1 call to WebformOptionsCustom::getTemplate()
WebformOptionsCustom::getElement in modules/webform_options_custom/src/Entity/WebformOptionsCustom.php
Get the custom options element.

File

modules/webform_options_custom/src/Entity/WebformOptionsCustom.php, line 263

Class

WebformOptionsCustom
Defines the webform options custom entity.

Namespace

Drupal\webform_options_custom\Entity

Code

public function getTemplate() {
  switch ($this->type) {
    case WebformOptionsCustomInterface::TYPE_URL:
      $url = $this
        ->getUrl();
      return $url ? file_get_contents($url) : '';
    default:
    case WebformOptionsCustomInterface::TYPE_TEMPLATE:
      return $this->template;
  }
}