You are here

public function WebformEntityReferenceTrait::getTestValues in Webform 8.5

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

File

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

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']);
}