Change record status: 
Project: 
Introduced in branch: 
8.x-4.x
Description: 

A collection of global scope functions used to retrieve counts of flags have been moved from the file flag.module into a dedicated service 'flag.count'.

In addition, several of these have had their parameters changed.

Here are the affected functions, with their replacements:

Gets the count of all flaggings for a flag

7.x

flag_get_entity_flag_counts($flag, 'node');

8.x

\Drupal::service('flag.count')->getFlagFlaggingCount($flag);

Get the count of the flaggings made by a user with a flag

7.x

flag_get_user_flag_counts($flag, $account);

8.x

\Drupal::service('flag.count')->getUserFlagFlaggingCount($flag, $account);

Get the counts of each flag's flaggings on an entity

7.x

flag_get_counts('node', $nid);

8.x

\Drupal::service('flag.count')->getEntityFlagCounts($node);

Get the count of all entities flagged by a flag

7.x

flag_get_flag_counts($flag_name);

8.x

\Drupal::service('flag.count')->getFlagFlaggingCount($flag);
Impacts: 
Module developers