Skip to content

Commit 5dffd7e

Browse files
committed
various fixes
1 parent 7ef6659 commit 5dffd7e

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

code/DropdownImageField.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,11 @@ public function Field($properties = array()) {
7979
}
8080

8181
/**
82-
* Gets the source array including any empty default values.
82+
* Gets the source
8383
*
84-
* @return array
84+
* @return Object
8585
*/
86-
public function getSourceObject() {
87-
if(is_object($this->source) && $this->getHasEmptyDefault()) {
88-
return $this->source->unshift(array($this->keyField = '', $this->labelField = $this->emptyString, $this->imageField = ''));
89-
} else {
90-
return $this->source;
91-
}
86+
public function getSource() {
87+
return $this->source;
9288
}
9389
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "copperis/dropdownimagefield",
33
"description": "Dropdown field with image support for SilverStripe CMS",
44
"type": "silverstripe-module",
5-
"keywords": ["silverstripe", "dropdown", "image"],
5+
"keywords": ["silverstripe", "dropdown", "image", "field"],
66
"license": "MIT",
77
"support": {
88
"issues": "http://github.com/Copperis/DropdownImageField/issues"

javascript/ImageSelect.jquery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
var option = options[i];
160160
var img_src = $(option).attr('data-img-src');
161161

162-
if(typeof img_src != undefined && img_src != ''){
162+
if(typeof img_src != 'undefined' && img_src != ''){
163163
var template = html_template.replace('{url}',img_src);
164164
// SS uses a modified Chosen.js and after the 'showing_dropdown' event the
165165
// values get immediatelly reset, also removing the images. Solved it with setTimeout.

0 commit comments

Comments
 (0)