public static function WebformElementHelper::randomize in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Utility/WebformElementHelper.php \Drupal\webform\Utility\WebformElementHelper::randomize()
Randomoize an associative array of element values and disable page caching.
Parameters
array $values: An associative array of element values.
Return value
array Randomized associative array of element values.
4 calls to WebformElementHelper::randomize()
- ContainerBase::prepare in src/
Plugin/ WebformElement/ ContainerBase.php - Prepare an element to be rendered within a webform.
- OptionsBase::prepare in src/
Plugin/ WebformElement/ OptionsBase.php - Prepare an element to be rendered within a webform.
- WebformImageSelect::setOptions in modules/
webform_image_select/ src/ Element/ WebformImageSelect.php - Set element #options from #images.
- WebformLikert::processWebformLikert in src/
Element/ WebformLikert.php - Processes a likert scale webform element.
File
- src/
Utility/ WebformElementHelper.php, line 842
Class
- WebformElementHelper
- Helper class webform element methods.
Namespace
Drupal\webform\UtilityCode
public static function randomize(array $values) {
// Make sure randomized elements and options are never cached by the
// current page.
\Drupal::service('page_cache_kill_switch')
->trigger();
return WebformArrayHelper::shuffle($values);
}