You are here

protected function WebformOptionsCustomEntity::setOptions in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_options_custom/src/Plugin/WebformElement/WebformOptionsCustomEntity.php \Drupal\webform_options_custom\Plugin\WebformElement\WebformOptionsCustomEntity::setOptions()

Get element options.

Parameters

array $element: An element.

array $settings: An array of settings used to limit and randomize options.

Overrides WebformEntityReferenceTrait::setOptions

File

modules/webform_options_custom/src/Plugin/WebformElement/WebformOptionsCustomEntity.php, line 28

Class

WebformOptionsCustomEntity
Provides a custom options entity reference element.

Namespace

Drupal\webform_options_custom\Plugin\WebformElement

Code

protected function setOptions(array &$element, array $settings = []) {
  list($type, $options_custom) = explode(':', $this
    ->getPluginId());
  $element['#type'] = $type;
  $element['#options_custom'] = $options_custom;

  /** @var \Drupal\webform_options_custom\Element\WebformOptionsCustomInterface $class */
  $class = $this
    ->getFormElementClassDefinition();
  $class::setTemplateOptions($element);
}