Permalink
Browse files

BUGFIX: Renamed UploadField::$config to UploadField::$ufConfig to avo…

…id conflicts with the config API.
  • Loading branch information...
1 parent 317756d commit d04fe07fa6b6e8da504e71c253456687ce538d83 @sminnee sminnee committed Mar 9, 2012
Showing with 12 additions and 5 deletions.
  1. +11 −4 forms/UploadField.php
  2. +1 −1 templates/UploadField.ss
View
@@ -73,7 +73,7 @@ class UploadField extends FileField {
* Config for this field used in both, php and javascript (will be merged into the config of the javascript file upload plugin)
* @var array
*/
- protected $config = array(
+ protected $ufConfig = array(
/**
* @var boolean
*/
@@ -265,7 +265,7 @@ protected function customiseFile(File $file) {
* @param mixed $val
*/
public function setConfig($key, $val) {
- $this->config[$key] = $val;
+ $this->ufConfig[$key] = $val;
return $this;
}
@@ -274,7 +274,14 @@ public function setConfig($key, $val) {
* @return mixed
*/
public function getConfig($key) {
- return $this->config[$key];
+ return $this->ufConfig[$key];
+ }
+
+ /**
+ * Used to get config in the template
+ */
+ public function getAutoUpload() {
+ return $this->getConfig('autoUpload');
}
/**
@@ -368,7 +375,7 @@ public function Field() {
if (is_numeric($config['maxNumberOfFiles']) && $this->getItems()->count()) {
$configOverwrite['maxNumberOfFiles'] = $config['maxNumberOfFiles'] - $this->getItems()->count();
}
- $config = array_merge($config, $this->config, $configOverwrite);
+ $config = array_merge($config, $this->ufConfig, $configOverwrite);
return $this->customise(array(
'configString' => str_replace('"', "'", Convert::raw2json($config)),
'config' => new ArrayData($config),
@@ -48,7 +48,7 @@
<input id="$id" name="$getName" class="$extraClass ss-uploadfield-fromcomputer-fileinput" data-config="$configString" type="file"<% if $multiple %> multiple="multiple"<% end_if %> />
</label>
<button class="ss-uploadfield-fromfiles ss-ui-button ui-corner-all" title="<% _t('UploadField.FROMCOMPUTERINFO', 'Select from from files') %>" data-icon="network-cloud"><% _t('UploadField.FROMCOMPUTER', 'From files') %></button>
- <% if not $config.autoUpload %>
+ <% if not $autoUpload %>
<button class="ss-uploadfield-startall ss-ui-button ui-corner-all" title="<% _t('UploadField.STARTALLINFO', 'Start all uploads') %>" data-icon="navigation"><% _t('UploadField.STARTALL', 'Start all') %></button>
<% end_if %>
<div class="clear"><!-- --></div>

0 comments on commit d04fe07

Please sign in to comment.