You are here

function _webform_theme_suggestions_options in Webform 8.5

Same name and namespace in other branches
  1. 6.x 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 1202
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;
}