+ /**
+ * Get any editor clash warning messages to show for the given draft revision.
+ *
+ * @param PageRevision|Page $draft
+ *
+ * @return string[]
+ */
+ public function getWarningMessagesForDraft($draft): array
+ {
+ $warnings = [];
+
+ if ($this->hasActiveEditing()) {
+ $warnings[] = $this->activeEditingMessage();
+ }
+
+ if ($draft instanceof PageRevision && $this->hasPageBeenUpdatedSinceDraftCreated($draft)) {
+ $warnings[] = trans('entities.pages_draft_page_changed_since_creation');
+ }
+
+ return $warnings;
+ }
+
+ /**
+ * Check if the page has been updated since the draft has been saved.
+ */
+ protected function hasPageBeenUpdatedSinceDraftCreated(PageRevision $draft): bool
+ {
+ return $draft->page->updated_at->timestamp > $draft->created_at->timestamp;
+ }
+