Skip to content

Commit

Permalink
Merge pull request #7 from xini/pull-major-actions
Browse files Browse the repository at this point in the history
clean up UI by displaying publish button within MajorActions if available
  • Loading branch information
dizzystuff authored Jun 5, 2024
2 parents 623e547 + 3401750 commit 16ca1df
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 16ca1df

Please sign in to comment.