WebformTableSort.php in Webform 6.x
File
src/Plugin/WebformElement/WebformTableSort.php
View source
<?php
namespace Drupal\webform\Plugin\WebformElement;
use Drupal\webform\WebformInterface;
class WebformTableSort extends OptionsBase {
use WebformTableTrait;
protected $exportDelta = TRUE;
protected function defineDefaultProperties() {
$properties = parent::defineDefaultProperties();
unset($properties['options_randomize']);
return $properties;
}
public function supportsMultipleValues() {
return TRUE;
}
public function hasMultipleValues(array $element) {
return TRUE;
}
public function getItemDefaultFormat() {
return 'ol';
}
public function getElementSelectorOptions(array $element) {
return [];
}
public function getTestValues(array $element, WebformInterface $webform, array $options = []) {
$values = array_keys($element['#options']);
if ($options['random']) {
shuffle($values);
}
return $values;
}
}