
| Current Path : /var/www/html/c12park/web/modules/contrib/webform/src/Element/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/c12park/web/modules/contrib/webform/src/Element/WebformAutocomplete.php |
<?php
namespace Drupal\webform\Element;
use Drupal\Core\Render\Element\Textfield;
/**
* Provides a one-line text field with autocompletion webform element.
*
* @FormElement("webform_autocomplete")
*/
class WebformAutocomplete extends Textfield {
/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
$info = parent::getInfo();
$info['#pre_render'][] = [$class, 'preRenderWebformAutocomplete'];
return $info;
}
/**
* Prepares a #type 'webform_autocomplete' render element for input.html.twig.
*
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #title, #value, #description, #size, #maxlength,
* #placeholder, #required, #attributes.
*
* @return array
* The $element with prepared variables ready for input.html.twig.
*/
public static function preRenderWebformAutocomplete($element) {
static::setAttributes($element, ['webform-autocomplete']);
return $element;
}
/**
* {@inheritdoc}
*/
protected function defineTranslatableProperties() {
return array_merge(parent::defineTranslatableProperties(), ['autocomplete_items']);
}
}