Error message

  • Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

function _paragraphs_library_count_usage

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

paragraphs/modules/paragraphs_library/paragraphs_library.module, line 178
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;
}