You are here

WebformBootstrapRenderCallbacks.php in Webform 6.x

Same filename and directory in other branches
  1. 8.5 modules/webform_bootstrap/src/WebformBootstrapRenderCallbacks.php

File

modules/webform_bootstrap/src/WebformBootstrapRenderCallbacks.php
View source
<?php

namespace Drupal\webform_bootstrap;

use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\RenderCallbackInterface;

/**
 * Render callbacks for the webform bootstrap module.
 */
class WebformBootstrapRenderCallbacks implements RenderCallbackInterface {

  /**
   * Render callback for the likerts element.
   *
   * @param array $element
   *   The render array.
   *
   * @return array
   *   The altered render array.
   */
  public static function webformLikertPreRender(array $element) {
    foreach (Element::children($element) as $element_key) {

      // Likerts allow description display to be configured, so disable
      // smart description.
      if (!empty($element[$element_key]['#description'])) {
        $element[$element_key]['#smart_description'] = FALSE;
      }
      $element[$element_key] = static::webformLikertPreRender($element[$element_key]);
    }
    return $element;
  }

}

Classes

Namesort descending Description
WebformBootstrapRenderCallbacks Render callbacks for the webform bootstrap module.