Merge pull request #840 from halkyon/compositefield_assetadmin_warning

AssetAdmin: PHP warning trying to add empty values into CompositeField
This commit is contained in:
Ingo Schommer 2013-08-28 06:44:09 -07:00
commit 2b20a02735

View File

@ -240,14 +240,17 @@ JS
$fields->push($tabs); $fields->push($tabs);
} }
// we only add buttons if they're available. User might not have permission and therefore
// the button shouldn't be available. Adding empty values into a ComposteField breaks template rendering.
$actionButtonsComposite = CompositeField::create()->addExtraClass('cms-actions-row');
if($uploadBtn) $actionButtonsComposite->push($uploadBtn);
if($addFolderBtn) $actionButtonsComposite->push($addFolderBtn);
if($syncButton) $actionButtonsComposite->push($syncButton);
// List view // List view
$fields->addFieldsToTab('Root.ListView', array( $fields->addFieldsToTab('Root.ListView', array(
$actionsComposite = CompositeField::create( $actionsComposite = CompositeField::create(
CompositeField::create( $actionButtonsComposite
$uploadBtn,
$addFolderBtn,
$syncButton //TODO: add this into a batch actions menu as in https://github.com/silverstripe/silverstripe-design/raw/master/Design/ss3-ui_files-manager-list-view.jpg
)->addExtraClass('cms-actions-row')
)->addExtraClass('cms-content-toolbar field'), )->addExtraClass('cms-content-toolbar field'),
$gridField $gridField
)); ));