You are here

function _template_progress_webform_set_title in Webform 8.5

Same name and namespace in other branches
  1. 6.x includes/webform.theme.template.inc \_template_progress_webform_set_title()

Set variables title to element #title or #admin_title.

Parameters

array $variables: An associative array containing the following key:

  • element: The webform element.

bool $strip_tags: Remove HTML tags from title.

2 calls to _template_progress_webform_set_title()
template_preprocess_webform_element_base_html in includes/webform.theme.template.inc
Prepares variables for webform element base HTML templates.
template_preprocess_webform_element_base_text in includes/webform.theme.template.inc
Prepares variables for webform element base text templates.

File

includes/webform.theme.template.inc, line 494
Preprocessors and helper functions to make theming easier.

Code

function _template_progress_webform_set_title(array &$variables, $strip_tags = FALSE) {
  $element = $variables['element'];

  // Set title.
  $variables['title'] = WebformElementHelper::isTitleDisplayed($element) ? $element['#title'] : NULL;
  if (empty($variables['title']) && !empty($element['#admin_title'])) {
    $variables['title'] = $element['#admin_title'];
  }

  // Strip all HTML tags from the title.
  if ($strip_tags) {
    $variables['title'] = strip_tags($variables['title']);
  }
}