mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-06-29 07:59:26 +02:00
Merge pull request #48 from mediabeastnz/added-isMultiple-option
Added option to disable multiple selections.
This commit is contained in:
commit
89767f93d3
|
@ -78,6 +78,24 @@ class StringTagField extends DropdownField {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getIsMultiple() {
|
||||||
|
return $this->isMultiple;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $isMultiple
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setIsMultiple($isMultiple) {
|
||||||
|
$this->isMultiple = $isMultiple;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return null|DataObject
|
* @return null|DataObject
|
||||||
*/
|
*/
|
||||||
|
@ -120,6 +138,10 @@ class StringTagField extends DropdownField {
|
||||||
|
|
||||||
$this->setAttribute('multiple', 'multiple');
|
$this->setAttribute('multiple', 'multiple');
|
||||||
|
|
||||||
|
if ($this->getIsMultiple()) {
|
||||||
|
$this->setAttribute('multiple', 'multiple');
|
||||||
|
}
|
||||||
|
|
||||||
if($this->getShouldLazyLoad()) {
|
if($this->getShouldLazyLoad()) {
|
||||||
$this->setAttribute('data-ss-tag-field-suggest-url', $this->getSuggestURL());
|
$this->setAttribute('data-ss-tag-field-suggest-url', $this->getSuggestURL());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -80,6 +80,24 @@ class TagField extends DropdownField {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getIsMultiple() {
|
||||||
|
return $this->isMultiple;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $isMultiple
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setIsMultiple($isMultiple) {
|
||||||
|
$this->isMultiple = $isMultiple;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -130,7 +148,9 @@ class TagField extends DropdownField {
|
||||||
|
|
||||||
$this->addExtraClass('ss-tag-field');
|
$this->addExtraClass('ss-tag-field');
|
||||||
|
|
||||||
$this->setAttribute('multiple', 'multiple');
|
if ($this->getIsMultiple()) {
|
||||||
|
$this->setAttribute('multiple', 'multiple');
|
||||||
|
}
|
||||||
|
|
||||||
if($this->shouldLazyLoad) {
|
if($this->shouldLazyLoad) {
|
||||||
$this->setAttribute('data-ss-tag-field-suggest-url', $this->getSuggestURL());
|
$this->setAttribute('data-ss-tag-field-suggest-url', $this->getSuggestURL());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user