FormValidator: Allow to set select2's dropdownParent property to SelectAjax element - refs BT#20637

pull/4668/head
Angel Fernando Quiroz Campos 3 years ago
parent 70174b6c40
commit e58b2ac23d
  1. 4
      main/inc/lib/formvalidator/Element/SelectAjax.php

@ -23,6 +23,8 @@ class SelectAjax extends HTML_QuickForm_select
public function toHtml()
{
$iso = api_get_language_isocode(api_get_interface_language());
$dropdownParent = $this->getAttribute('dropdownParent');
$dropdownParentCondition = $dropdownParent ? "dropdownParent: '$dropdownParent'," : '';
$formatResult = $this->getAttribute('formatResult');
$formatSelection = $this->getAttribute('formatSelection');
$formatCondition = '';
@ -93,6 +95,7 @@ class SelectAjax extends HTML_QuickForm_select
width: '$width',
minimumInputLength: '$minimumInputLength',
tags: $tags,
$dropdownParentCondition
ajax: {
url: $url,
delay: $delay,
@ -130,6 +133,7 @@ JS;
$this->removeAttribute('class');
$this->removeAttribute('url');
$this->removeAttribute('url_function');
$this->removeAttribute('dropdownParent');
$this->setAttribute('style', 'width: 100%;');
return parent::toHtml().$html;

Loading…
Cancel
Save