You are here

README.txt in Entity Usage 8

Same filename and directory in other branches
  1. 8.4 README.txt
  2. 8.2 README.txt
  3. 8.3 README.txt
Entity Usage
============

This module is a proof-of-concept for a tool to track usage of entities by other
entities in drupal.

Currently only the tracking of entities linked to each other using one of the
following methods is supported:
 - through entity_reference fields
 - embedded into text fields (using the "Entity Embed" module)

There is no specific configuration, once enabled, the module will start tracking
the relation between entities, getting updated on all CRUD entity operations.

A basic views integration is provided. To use the tracked information in a view,
follow the following steps:
 1) Create a view that has as base table any content entity (Node, User, Etc)
 2) Add a relationship to your view named
    "Information about the usage of this @entity_type"
 3) After adding the relationship, add the field to your view:
    "Usage count"
 4) You will probably want to enable aggregation, to avoid duplicate rows and
 have the real count sum. To do that, go to the "Advanced" section of the view
 configuration, select "Use aggregation" to "Yes"
 5) Go to the "Usage count" field you added before, open up the "Aggregation
 settings" form, and select "SUM".

In your view (or anywhere else) you can build a link to the page where you can
consult the details of the entities that use (reference) any given entity. Build
the link using the following structure:
  /admin/content/entity-usage/{entity_type}/{entity_id}
Make sure the visitors of this page have the permission to 'access entity usage
statistics' enabled.

This module is in early development phase. Please help testing it and provide
feedback on the issue queue.

==== FOR DEVELOPERS ====

The tracking information recorded by this module is stored at the "entity_usage"
table.

You can use the service
  \Drupal::service('entity_usage.usage')->listUsage($entity);
to get the statistics anywhere in your code.

If you want to provide your own tracking method (additionally to the methods
provided by the module: entity_reference and entity_embed), you only need to
implement a plugin of type EntityUsageTrack, which will be used on all CRUD
entity operations. Examples of how to implement the plugin can be found in
 src/Plugin/EntityUsage/Track

Feedback is very welcome on the issue queue.

File

README.txt
View source
  1. Entity Usage
  2. ============
  3. This module is a proof-of-concept for a tool to track usage of entities by other
  4. entities in drupal.
  5. Currently only the tracking of entities linked to each other using one of the
  6. following methods is supported:
  7. - through entity_reference fields
  8. - embedded into text fields (using the "Entity Embed" module)
  9. There is no specific configuration, once enabled, the module will start tracking
  10. the relation between entities, getting updated on all CRUD entity operations.
  11. A basic views integration is provided. To use the tracked information in a view,
  12. follow the following steps:
  13. 1) Create a view that has as base table any content entity (Node, User, Etc)
  14. 2) Add a relationship to your view named
  15. "Information about the usage of this @entity_type"
  16. 3) After adding the relationship, add the field to your view:
  17. "Usage count"
  18. 4) You will probably want to enable aggregation, to avoid duplicate rows and
  19. have the real count sum. To do that, go to the "Advanced" section of the view
  20. configuration, select "Use aggregation" to "Yes"
  21. 5) Go to the "Usage count" field you added before, open up the "Aggregation
  22. settings" form, and select "SUM".
  23. In your view (or anywhere else) you can build a link to the page where you can
  24. consult the details of the entities that use (reference) any given entity. Build
  25. the link using the following structure:
  26. /admin/content/entity-usage/{entity_type}/{entity_id}
  27. Make sure the visitors of this page have the permission to 'access entity usage
  28. statistics' enabled.
  29. This module is in early development phase. Please help testing it and provide
  30. feedback on the issue queue.
  31. ==== FOR DEVELOPERS ====
  32. The tracking information recorded by this module is stored at the "entity_usage"
  33. table.
  34. You can use the service
  35. \Drupal::service('entity_usage.usage')->listUsage($entity);
  36. to get the statistics anywhere in your code.
  37. If you want to provide your own tracking method (additionally to the methods
  38. provided by the module: entity_reference and entity_embed), you only need to
  39. implement a plugin of type EntityUsageTrack, which will be used on all CRUD
  40. entity operations. Examples of how to implement the plugin can be found in
  41. src/Plugin/EntityUsage/Track
  42. Feedback is very welcome on the issue queue.