This project is not covered by Drupal’s security advisory policy.

What is this?

This module provides an easy way for an entity to calculate the average/sum/min/max of a field on other entities that are currently referencing it through a Entity Reference field.

This module is heavily based upon the Entity Reference Count module. Even this project page description is heavily based on that module.

How it works

This Entity Reference Calc is in-and-of itself, just another field type (called "entityreference_calc" in the code) that may be attached to any Drupal entity. The field can be configured to select which referencing entity types and fields you want to do the calculation on.

The calculation field is automatically re-calculated when the referencing or referenced entity get inserted, updated or deleted. The Entity Reference Calcs's numeric field value may be enabled, displayed and manipulated via view modes, through the "Manage Fields" interface provided by Drupal core's Field UI, and has built-in Views integration.

Installation

  • Copy entityreference_calc to your module directory and then enable on the admin modules page.
  • Be sure you have at least one EntityReference field configured and then add an EntityReference_Calc field to a content type that is referenced by a EntityReference. Check the boxes for the EntityReference fields that should be counted.
  • Select the field on the referencing entity that you would like to do calculation on and the aggregation type (average/sum/max/min).
  • You will need to re-save any existing entities or their referencing entities in order to update the count that will be empty for all the entities that exist previous to the installation of this module.

Credits

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Module categories: Site Structure
  • chart icon34 sites report using this module
  • Created by frjo on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases