Skip to content

Commit

Permalink
Merge pull request unclecheese#44 from mmichelli/patch-2
Browse files Browse the repository at this point in the history
To get updateCMSFields for DataObjectDecorator to work
  • Loading branch information
unclecheese committed Jun 4, 2012
2 parents ff0b96c + 0ce177b commit d85d6e2
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions code/KickAssetAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -662,20 +662,33 @@ protected function getFieldsForFile($file) {
new LiteralField('ReplaceFileText','<h4>'._t('KickAssets.REPLACEFILE','Replace file').'</h4><div id="replace-file" data-uploadurl="'.$this->Link("replace/{$this->getCurrentFolderID()}/{$file->ID}").'">'.$filename.'</div>'),
new HiddenField('ID','')
);

foreach ($file->extension_instances as $ext) {
$this->updateExtensionCMSFields($ext, $fields);
}

$owner->setEmptyString('('._t('KickAssets.NONE','None').')');
$folders->setEmptyString('(root)');
if($file->hasMethod('updateCMSFields')) {
if(version_compare(PHP_VERSION, '5.3') >= 0) {
$file->updateCMSFields(&$fields);
}
else {
$file->updateCMSFields($fields);
}

}

return $fields;
}

/**
* Allow for the decorator pattern by providing and extend() to updateCMSFields.
* @param Object
* @param FieldSet
*/
protected function updateExtensionCMSFields($ext, $fields) {

if(version_compare(PHP_VERSION, '5.3') >= 0) {
$ext->updateCMSFields(&$fields);
}
else {
$ext->updateCMSFields($fields);
}

}



/**
Expand Down

0 comments on commit d85d6e2

Please sign in to comment.