Skip to content

Commit

Permalink
Merge pull request #145 from mjvcallibrity/master
Browse files Browse the repository at this point in the history
Create conditional that checks state to properly display saved / save draft button
  • Loading branch information
Aaron Carlino committed Sep 16, 2016
2 parents 37bdaa8 + 1272872 commit a703795
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions code/buttons/BetterButton_SaveDraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,20 @@ public function baseTransform() {
->setAttribute('data-icon-alternate', 'addpage')
->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'));
}


/**
* Update the UI to reflect unsaved state
* @return void
*/
public function transformToButton() {
parent::transformToButton();

if($this->gridFieldRequest->recordIsDeletedFromStage()) {
$this->addExtraClass('ss-ui-alternate');
}

return $this;
}

}

0 comments on commit a703795

Please sign in to comment.