You are here

function _webform_theme_suggestions_options in Webform 6.x

Same name and namespace in other branches
  1. 8.5 includes/webform.theme.inc \_webform_theme_suggestions_options()

Add webform options display suggestions to radios and checkboxes.

Parameters

array $variables: Template variables.

string $type: Type of options element. (checkboxes or radios)

Return value

array If element include #options_display a template suggestion for TYPE-OPTIONS-DISPLAY

2 calls to _webform_theme_suggestions_options()
webform_theme_suggestions_checkboxes in includes/webform.theme.inc
Implements hook_theme_suggestions_HOOK().
webform_theme_suggestions_radios in includes/webform.theme.inc
Implements hook_theme_suggestions_HOOK().

File

includes/webform.theme.inc, line 1215
Theme hooks, preprocessor, and suggestions.

Code

function _webform_theme_suggestions_options(array $variables, $type) {
  if (!WebformElementHelper::isWebformElement($variables['element'])) {
    return [];
  }
  $element = $variables['element'];
  $suggestions = [];
  if (!empty($element['#options_display']) && strpos($element['#options_display'], 'buttons') === 0) {
    $suggestions[] = $type . '__webform_' . $element['#options_display'];
  }
  return $suggestions;
}