You are here

function hook_entity_usage_block_tracking in Entity Usage 8.2

Same name and namespace in other branches
  1. 8.4 entity_usage.api.php \hook_entity_usage_block_tracking()
  2. 8.3 entity_usage.api.php \hook_entity_usage_block_tracking()

Allows modules to block a specific tracking record.

Modules implementing this hook should return TRUE if the operation should be blocked. Any other return value will be disregarded and the register written to the database.

Parameters

int $target_id: The target entity ID.

string $target_type: The target entity type.

int $source_id: The source entity ID.

string $source_type: The source entity type.

string $source_langcode: The source entity language code.

string $source_vid: The source entity revision ID.

string $method: The method used to relate source entity with the target entity. Normally the plugin id.

string $field_name: The name of the field in the source entity using the target entity.

int $count: The number of usages being tracked or deleted.

1 function implements hook_entity_usage_block_tracking()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_usage_test_entity_usage_block_tracking in tests/modules/entity_usage_test/entity_usage_test.module
Implements hook_entity_usage_block_tracking().
1 invocation of hook_entity_usage_block_tracking()
EntityUsage::registerUsage in src/EntityUsage.php
Register or update a usage record.

File

./entity_usage.api.php, line 40
Hooks for the entity_usage module.

Code

function hook_entity_usage_block_tracking($target_id, $target_type, $source_id, $source_type, $source_langcode, $source_vid, $method, $field_name, $count) {
  if ($field_name === 'field_foo_bar' && $method === 'link') {
    return TRUE;
  }
  return FALSE;
}