當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityInterface::getRevisionCreationTime方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityInterface::getRevisionCreationTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityInterface::getRevisionCreationTime方法的具體用法?PHP EntityInterface::getRevisionCreationTime怎麽用?PHP EntityInterface::getRevisionCreationTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityInterface的用法示例。


在下文中一共展示了EntityInterface::getRevisionCreationTime方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // The revision timestamp will be updated when the revision is saved. Keep
     // the original one for the confirmation message.
     $this->revision = $this->prepareRevision($this->revision);
     if ($this->revision instanceof RevisionLogInterface) {
         $original_revision_timestamp = $this->revision->getRevisionCreationTime();
         $this->revision->setRevisionLogMessage($this->t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]));
         drupal_set_message(t('@type %title has been reverted to the revision from %revision-date.', ['@type' => $this->getBundleLabel($this->revision), '%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
     } else {
         drupal_set_message(t('@type %title has been reverted', ['@type' => $this->getBundleLabel($this->revision), '%title' => $this->revision->label()]));
     }
     $this->revision->save();
     $this->logger('content')->notice('@type: reverted %title revision %revision.', ['@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
     $form_state->setRedirect("entity.{$this->revision->getEntityTypeId()}.version_history", [$this->revision->getEntityTypeId() => $this->revision->id()]);
 }
開發者ID:CIGIHub,項目名稱:bsia-drupal8,代碼行數:19,代碼來源:RevisionRevertForm.php

示例2: revisionTitle

 /**
  * Returns a string providing the title of the revision.
  *
  * @param \Drupal\Core\Entity\EntityInterface $_entity_revision
  *   Returns a string to provide the title of the revision.
  *
  * @return string
  *   Revision title.
  */
 public function revisionTitle(EntityInterface $_entity_revision)
 {
     if ($_entity_revision instanceof TimestampedRevisionInterface) {
         return $this->t('Revision of %title from %date', array('%title' => $_entity_revision->label(), '%date' => format_date($_entity_revision->getRevisionCreationTime())));
     } else {
         return $this->t('Revision of %title', array('%title' => $_entity_revision->label()));
     }
 }
開發者ID:heddn,項目名稱:content_entity_base,代碼行數:17,代碼來源:RevisionController.php


注:本文中的Drupal\Core\Entity\EntityInterface::getRevisionCreationTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。