Skip to content

Commit

Permalink
display publish button within MajorActions if available
Browse files Browse the repository at this point in the history
  • Loading branch information
xini committed Apr 26, 2024
1 parent 623e547 commit 3401750
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Extensions/ElementalAreasContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ public function onAfterDuplicate(DataObject $original, bool $doWrite): void

public function updateCMSActions(FieldList $actions)
{
$actions->push(
$action = CustomAction::create('doPublishWithAreas', 'Publish (including all blocks)')
->setShouldRefresh(true)
->addExtraClass('btn-outline-primary')
->removeExtraClass('btn-info')
);
$action->setAttribute('style', 'margin-left:auto;');
$action = CustomAction::create('doPublishWithAreas', 'Publish (including all blocks)')
->setShouldRefresh(true)
->addExtraClass('btn-outline-primary')
->removeExtraClass('btn-info');

$MajorActions = $actions->fieldByName('MajorActions');

if ($MajorActions) {
$MajorActions->push($action);
} else {
$actions->push($action);
$action->setAttribute('style', 'margin-left:auto;');
}
}

public function doPublishWithAreas()
Expand Down

0 comments on commit 3401750

Please sign in to comment.