You are here

trait YamlFormEntityOptionsTrait in YAML Form 8

Provides an 'entity_reference' with options trait.

Hierarchy

File

src/Plugin/YamlFormElement/YamlFormEntityOptionsTrait.php, line 11

Namespace

Drupal\yamlform\Plugin\YamlFormElement
View source
trait YamlFormEntityOptionsTrait {

  /**
   * {@inheritdoc}
   */
  public function getDefaultProperties() {
    $properties = parent::getDefaultProperties() + [
      // Entity reference settings.
      'target_type' => '',
      'selection_handler' => '',
      'selection_settings' => [],
    ];
    unset($properties['options']);
    return $properties;
  }

  /**
   * {@inheritdoc}
   */
  public function prepare(array &$element, YamlFormSubmissionInterface $yamlform_submission) {
    YamlFormEntityTrait::setOptions($element);
    parent::prepare($element, $yamlform_submission);
  }

  /**
   * {@inheritdoc}
   */
  protected function getElementSelectorInputsOptions(array $element) {
    YamlFormEntityTrait::setOptions($element);
    return parent::getElementSelectorInputsOptions($element);
  }

}

Members