Skip to content

Views and extending

Views

Views data: Drupal\moderation_note\ModerationNoteViewsData (src/ModerationNoteViewsData.php).

  • Base table: moderation_note (provider: moderation_note; base field: id).
  • Relationship: “Notated content” — relates entity_id + entity_langcode to node_field_data (nid, langcode). Other entity types can be added similarly.
  • Field: “Link to note” — plugin moderation_note_link (ModerationNoteLink), links to the note in context.
  • Filters: parent allows empty; uid and assignee use user_name filter.

Use Views to list notes, filter by author/assignee/entity, and expose “Link to note”.

Extending

  • Entity: Implement or extend ModerationNoteInterface for custom logic; entity class is ModerationNote.
  • Templates: Override moderation_note.html.twig, moderation_note--preview.html.twig, or mail-moderation-note.html.twig in a theme.
  • Hooks: Implement hook_entity_delete, hook_mail, etc., or alter data in existing hooks (see Hooks and events).
  • Access: Access is in AccessControlHandler; no separate events for note access. Entity hooks (e.g. insert/update) run after save.
  • Menu count: Replace or decorate moderation_note.menu_count service if you need different “View notes” or “Assigned notes” behavior.

Multilingual

Each note stores entity_langcode. Notes are scoped to the language of the field being notated, so the same content in different languages can have separate note threads.