Created on 12 August 2025, 18 days ago

Problem/Motivation

The Entity Mesh module currently doesn't provide a way to identify isolated nodesβ€”that is, nodes that are referenced by other nodes but don't reference any themselves. It would be very useful to have a statistics table that makes it easy to identify these nodes. Additionally, the table should show how many nodes reference a specific node and how many nodes a particular node references. This feature would give site administrators better insights into the content relationships on their site.

Steps to reproduce

  • Install and configure the Entity Mesh module on a Drupal site with existing content.
  • Create several nodes with entity reference fields, so they reference each other.
  • Ensure some nodes are referenced by other nodes but do not reference any themselves (isolated nodes in the context of the requested feature).
  • Navigate to the Entity Mesh interface.
  • Observe that there is no readily available information or a statistics table to identify these isolated nodes or to see the number of incoming and outgoing references for each node.

Proposed resolution

The proposed solution is to introduce a new database table to store and manage this statistical information efficiently. This table would track incoming and outgoing references for each node.

A new database table would be created to store the following data:

  • node type: The node type.
  • node_id: The ID of the node being tracked.
  • incoming_references: A count of how many other nodes reference this node.
  • outgoing_references: A count of how many nodes this node references.

The data in this table will be updated in two key scenarios:

  • Upon completion of Entity Mesh processes: When the main Entity Mesh process runs, it will rebuild this statistics table, ensuring the data is current.
  • On node CRUD operations: Using Drupal's hook system (hook_node_insert, hook_node_update, hook_node_delete).

This approach ensures the data remains up-to-date in real-time without needing to run the full Entity Mesh process.

This new table would enable the creation of a statistics page or block where administrators can easily see and filter nodes based on their reference counts, including identifying nodes with zero outgoing references (the isolated nodes).

Remaining tasks

  • Define the schema for the new database table.
  • Implement the hooks for node CRUD operations to update the statistics table.
  • Modify the Entity Mesh processes to include a step for rebuilding this table.
  • Develop a new user interface component (e.g., a page, a block, or a new tab on the Entity Mesh page) to display the statistics.
  • Write automated tests to ensure the new functionality works correctly and the data remains accurate.

User interface changes

A new page or tab will be added to the Entity Mesh administration section. This page will display the statistics table, showing node titles, incoming reference counts, and outgoing reference counts. The table will be sortable and filterable.

API changes

No significant API changes are anticipated, but new functions might be introduced to interact with the new statistics table.

Data model changes

A new database table will be added to store node reference statistics. The specific name and fields for this table will be defined during development.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024