src/Buttons/BetterButton_Publish.php
public function transformToButton()
    {
        parent::transformToButton();

        if ($this->gridFieldRequest->recordIsPublished()) {
            $this->setTitle(_t('SiteTree.BUTTONPUBLISHED', 'Published'));
        }

        if ($this->gridFieldRequest->record->stagesDiffer('Stage', 'Live')
            && $this->gridFieldRequest->recordIsDeletedFromStage()
        ) {
            $this->addExtraClass('ss-ui-alternate');
        }

        return $this;
    }
public function transformToButton()
    {
        parent::transformToButton();

        if ($this->gridFieldRequest->recordIsPublished()) {
            $this->setTitle(_t('SiteTree.BUTTONPUBLISHED', 'Published'));
        }

        if ($this->gridFieldRequest->record->stagesDiffer('Stage', 'Live')
            && $this->gridFieldRequest->recordIsDeletedFromStage()
        ) {
            $this->addExtraClass('ss-ui-alternate');
        }

        return $this;
    }
public function transformToButton ( ) { parent :: transformToButton ( ) ; if ( $ this -> gridFieldRequest -> recordIsPublished ( ) ) { $ this -> setTitle ( _t ( 'SiteTree.BUTTONPUBLISHED' , 'Published' ) ) ; } if ( $ this -> gridFieldRequest -> record -> stagesDiffer ( 'Stage' , 'Live' ) && $ this -> gridFieldRequest -> recordIsDeletedFromStage ( ) ) { $ this -> addExtraClass ( 'ss-ui-alternate' ) ; } return $ this ; }
Update the UI to reflect published state
@return void
Update the UI to reflect published state