code: 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;
      }
docs: Update the UI to reflect published state
  @return void