public function Date::prepare in YAML Form 8
Prepare an element to be rendered within a form.
Parameters
array $element: An element.
\Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission: A form submission.
Overrides DateBase::prepare
File
- src/
Plugin/ YamlFormElement/ Date.php, line 44
Class
- Date
- Provides a 'date' element.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
public function prepare(array &$element, YamlFormSubmissionInterface $yamlform_submission) {
parent::prepare($element, $yamlform_submission);
// Set the (input) type attribute to 'date' since #min and #max will
// override the default attributes.
// @see \Drupal\Core\Render\Element\Date::getInfo
$element['#attributes']['type'] = 'date';
// Issue #2817693 by danbohea: Min date option not working with jQuery UI
// datepicker.
$element['#attached']['library'][] = 'yamlform/yamlform.element.date';
}