type; } /** * {@inheritdoc} */ public function isLocked() { $locked = \Drupal::state()->get('node.type.locked'); return isset($locked[$this->id()]) ? $locked[$this->id()] : FALSE; } /** * {@inheritdoc} */ public function setNewRevision($new_revision) { $this->new_revision = $new_revision; } /** * {@inheritdoc} */ public function displaySubmitted() { return $this->display_submitted; } /** * {@inheritdoc} */ public function setDisplaySubmitted($display_submitted) { $this->display_submitted = $display_submitted; } /** * {@inheritdoc} */ public function getPreviewMode() { return $this->preview_mode; } /** * {@inheritdoc} */ public function setPreviewMode($preview_mode) { $this->preview_mode = $preview_mode; } /** * {@inheritdoc} */ public function getHelp() { return $this->help ?? ''; } /** * {@inheritdoc} */ public function getDescription() { return $this->description ?? ''; } /** * {@inheritdoc} */ public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); if ($update && $this->getOriginalId() != $this->id()) { $update_count = $storage->updateType($this->getOriginalId(), $this->id()); if ($update_count) { \Drupal::messenger()->addStatus(\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.', [ '%old-type' => $this->getOriginalId(), '%type' => $this->id(), ])); } } if ($update) { // Clear the cached field definitions as some settings affect the field // definitions. \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); } } /** * {@inheritdoc} */ public static function postDelete(EntityStorageInterface $storage, array $entities) { parent::postDelete($storage, $entities); // Clear the node type cache to reflect the removal. $storage->resetCache(array_keys($entities)); } /** * {@inheritdoc} */ public function shouldCreateNewRevision() { return $this->new_revision; } }