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


PHP ContentEntityBase::preSaveRevision方法代碼示例

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


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

示例1: testPreSaveRevision

 /**
  * @covers ::preSaveRevision
  */
 public function testPreSaveRevision()
 {
     // This method is internal, so check for errors on calling it only.
     $storage = $this->getMock('\\Drupal\\Core\\Entity\\EntityStorageInterface');
     $record = new \stdClass();
     // Our mocked entity->preSaveRevision() returns NULL, so assert that.
     $this->assertNull($this->entity->preSaveRevision($storage, $record));
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:11,代碼來源:ContentEntityBaseUnitTest.php

示例2: preSaveRevision

 /**
  * {@inheritdoc}
  */
 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record)
 {
     parent::preSaveRevision($storage, $record);
     if (!$this->isNewRevision() && isset($this->original) && (!isset($record->revision_log) || $record->revision_log === '')) {
         // If we are updating an existing entity without adding a new
         // revision and the user did not supply a revision log, keep the existing
         // one.
         $record->revision_log = $this->original->getRevisionLog();
     }
 }
開發者ID:heddn,項目名稱:content_entity_base,代碼行數:13,代碼來源:EntityBase.php

示例3: preSaveRevision

 /**
  * {@inheritdoc}
  */
 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record)
 {
     parent::preSaveRevision($storage, $record);
     if (!$this->isNewRevision() && isset($this->original) && (!isset($record->revision_log) || $record->revision_log === '')) {
         // If we are updating an existing node without adding a new revision, we
         // need to make sure $entity->revision_log is reset whenever it is empty.
         // Therefore, this code allows us to avoid clobbering an existing log
         // entry with an empty one.
         $record->revision_log = $this->original->revision_log->value;
     }
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:14,代碼來源:Node.php

示例4: preSaveRevision

 /**
  * {@inheritdoc}
  */
 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record)
 {
     parent::preSaveRevision($storage, $record);
     if (!isset($record->revision_log)) {
         $record->revision_log = '';
     }
     $account = \Drupal::currentUser();
     $record->uid = $account->id();
 }
開發者ID:jasonruyle,項目名稱:crm_core,代碼行數:12,代碼來源:Contact.php

示例5: preSaveRevision

 /**
  * {@inheritdoc}
  */
 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record)
 {
     parent::preSaveRevision($storage, $record);
 }
開發者ID:eric-shell,項目名稱:eric-shell-d8,代碼行數:7,代碼來源:Paragraph.php


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