/** * {@inheritdoc} */ public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); if ($update && $this->getOriginalId() != $this->id()) { $update_count = node_type_update_nodes($this->getOriginalId(), $this->id()); if ($update_count) { drupal_set_message(\Drupal::translation()->formatPlural($update_count, 'Changed the content type of 1 post from %old-type to %type.', 'Changed the content type of @count posts from %old-type to %type.', array('%old-type' => $this->getOriginalId(), '%type' => $this->id()))); } } if ($update) { // Clear the cached field definitions as some settings affect the field // definitions. $this->entityManager()->clearCachedFieldDefinitions(); } }
/** * {@inheritdoc} */ public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); if (!$update) { // Create a body if the create_body property is true and we're not in // the syncing process. if ($this->get('create_body') && !$this->isSyncing()) { $label = $this->get('create_body_label'); node_add_body_field($this, $label); } } elseif ($this->getOriginalId() != $this->id()) { $update_count = node_type_update_nodes($this->getOriginalId(), $this->id()); if ($update_count) { drupal_set_message(format_plural($update_count, 'Changed the content type of 1 post from %old-type to %type.', 'Changed the content type of @count posts from %old-type to %type.', array('%old-type' => $this->getOriginalId(), '%type' => $this->id()))); } } if ($update) { // Clear the cached field definitions as some settings affect the field // definitions. $this->entityManager()->clearCachedFieldDefinitions(); } }