mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
Minor fixtures
This commit is contained in:
parent
d898281925
commit
affec6aaac
@ -1,28 +0,0 @@
|
||||
---
|
||||
Name: a2nt-cms-niceties-env-check
|
||||
---
|
||||
|
||||
SilverStripe\EnvironmentCheck\EnvironmentCheckSuite:
|
||||
registered_checks:
|
||||
curl:
|
||||
definition: 'HasFunctionCheck("curl_init")'
|
||||
title: 'is curl available?'
|
||||
gd:
|
||||
definition: 'HasFunctionCheck("imagecreatetruecolor")'
|
||||
title: 'Does PHP have GD2 support?'
|
||||
db:
|
||||
definition: 'DatabaseCheck("Page")'
|
||||
title: 'Is the database accessible?'
|
||||
url:
|
||||
definition: 'URLCheck()'
|
||||
title: 'Is the homepage accessible?'
|
||||
registered_suites:
|
||||
check:
|
||||
- curl
|
||||
- gd
|
||||
- db
|
||||
- url
|
||||
health:
|
||||
- db
|
||||
- url
|
||||
|
@ -44,15 +44,16 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider
|
||||
|
||||
public function getHTMLFragments($gridField)
|
||||
{
|
||||
$singleton = singleton($gridField->getModelClass());
|
||||
$class = $gridField->getModelClass();
|
||||
$singleton = singleton($class);
|
||||
|
||||
if (!$singleton->canEdit() && !$singleton->canCreate()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!$this->buttonName) {
|
||||
if ($this->publish && $singleton->hasExtension('Versioned')) {
|
||||
$this->buttonName = _t('GridField.SAVE_ALL_AND_PUBLISH', 'Save all and publish');
|
||||
if ($this->publish && $singleton->hasExtension(Versioned::class)) {
|
||||
$this->buttonName = _t('GridField.SAVE_ALL_AND_PUBLISH', 'Save all and Publish');
|
||||
} else {
|
||||
$this->buttonName = _t('GridField.SAVE_ALL', 'Save all');
|
||||
}
|
||||
@ -93,7 +94,9 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider
|
||||
|
||||
protected function saveAllRecords(GridField $grid, $arguments, $data)
|
||||
{
|
||||
if (!isset($data[$grid->Name])) {
|
||||
if (!isset($data[$grid->Name])
|
||||
|| !isset($data[$grid->Name]['GridFieldEditableColumns'])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -109,7 +112,7 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider
|
||||
}
|
||||
|
||||
// Only use the viewable list items, since bulk publishing can take a toll on the system
|
||||
$paginator = $cfg->getComponentByType('GridFieldPaginator');
|
||||
$paginator = $cfg->getComponentByType(GridFieldPaginator::class);
|
||||
$list = $paginator
|
||||
? $paginator->getManipulatedData($grid, $grid->List)
|
||||
: $grid->List;
|
||||
@ -138,10 +141,13 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider
|
||||
|
||||
if ($this->publish) {
|
||||
$list->each(function ($item) {
|
||||
if ($item->hasExtension('Versioned')) {
|
||||
if ($item->hasExtension(Versioned::class)) {
|
||||
$item->writeToStage('Stage');
|
||||
|
||||
if (!$item->stagesDiffer()) {
|
||||
$item->copyVersionToStage('Stage', 'Live');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user