Skip to content

Architecture

Entity

The module defines a content entity moderation_note:

  • Class: Drupal\moderation_note\Entity\ModerationNote
  • Base table: moderation_note
  • URI callback: moderation_note_uri (see Hooks and events)
  • Admin permission: administer moderation notes
  • Fieldable: No

Base fields

Field Type Purpose
parent entity_reference (moderation_note) Parent note if this is a reply
uid entity_reference (user) Author
entity_type string Notated entity type ID
entity_id integer Notated entity ID
entity_field_name string Field on the entity this note is attached to
entity_langcode string Language of the notated field
entity_view_mode_id string View mode when the note was created
quote string_long Selected text (quote)
quote_offset integer Offset of the quote within the field
text string_long Note body
assignee entity_reference (user) Optional assignee
published boolean Published = open; unpublished = resolved
created / changed created / changed Timestamps

Handlers

  • Access: Drupal\moderation_note\AccessControlHandler
  • View builder: Drupal\moderation_note\ModerationNoteViewBuilder
  • Forms: create/edit/reply → ModerationNoteForm; delete → ModerationNoteDeleteForm; resolve → ModerationNoteResolveForm
  • Views data: Drupal\moderation_note\ModerationNoteViewsData

Interface

Drupal\moderation_note\ModerationNoteInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface, EntityPublishedInterface.

Main methods (see interface for full list):

  • Parent/children: hasParent(), getParent(), getChildren()
  • Moderated entity: getModeratedEntity(), setModeratedEntity(), getModeratedEntityTypeId(), getModeratedEntityId(), setModeratedEntityById()
  • Field/language/view mode: getEntityFieldName(), setEntityFieldName(), getEntityLanguage(), setEntityLanguage(), getEntityViewModeId(), setEntityViewModeId()
  • Content: getQuote(), setQuote(), getQuoteOffset(), setQuoteOffset(), getText(), setText()
  • Assignee: getAssignee(), setAssignee()

Storage and relation

  • One base table; no separate revision table.
  • A note is uniquely tied to: moderated entity (type + id) + field name + langcode + view mode. Replies share the same entity/field/langcode/view mode and link via parent.