You are here

public function WebformEntityReferenceTrait::getTestValues in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformEntityReferenceTrait.php \Drupal\webform\Plugin\WebformElement\WebformEntityReferenceTrait::getTestValues()

File

src/Plugin/WebformElement/WebformEntityReferenceTrait.php, line 174

Class

WebformEntityReferenceTrait
Provides an 'entity_reference' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function getTestValues(array $element, WebformInterface $webform, array $options = []) {
  $this
    ->setOptions($element, [
    'limit' => 10,
    'random' => TRUE,
  ]);

  // Exclude 'anonymous' user.
  $target_type = $this
    ->getTargetType($element);
  if ($target_type === 'user') {
    unset($element['#options'][0]);
  }
  return array_keys($element['#options']);
}