function _paragraphs_library_count_usage in Paragraphs 8
Counts the usage across all entities.
Parameters
array $usage_data: Array of usage data returned from Entity Usage service.
Return value
int Returns the count of entity usage across all entities.
See also
\Drupal\entity_usage\EntityUsageInterface::listSources()
File
- modules/
paragraphs_library/ paragraphs_library.module, line 182 - Main module file for the Paragraphs Library module.
Code
function _paragraphs_library_count_usage(array $usage_data) {
$count = 0;
foreach ($usage_data as $entities) {
// We only want to register usages by different entities, ignoring usages
// accross revisions / translations / fields of the same entity.
$count += count($entities);
}
return $count;
}