You are here

function hook_realistic_dummy_content_api_class in Realistic Dummy Content 7

Same name and namespace in other branches
  1. 8.2 api/realistic_dummy_content_api.api.php \hook_realistic_dummy_content_api_class()
  2. 8 api/realistic_dummy_content_api.api.php \hook_realistic_dummy_content_api_class()
  3. 7.2 api/realistic_dummy_content_api.api.php \hook_realistic_dummy_content_api_class()
  4. 3.x api/realistic_dummy_content_api.api.php \hook_realistic_dummy_content_api_class()


Return any object which is a subclass of RealisticDummyContentBase, which will be used to modify content which is deemed to be dummy content.


$entity: The object for a given type, for example this can be a user object or a node object.

$type: The entity type of the information to change, for example 'user' or 'node'.

$filter: If set, only certain fields will be considered when manipulating the object. This can be useful, for example for users, because two separate manipulations need to be performed, depending on whether hook_user_insert() or hook_user_presave(). Both hooks need to modify only certain properties and fields, but taken together the entire object can be manipulated. The filter is an associative array which can contain no key (all fields and properties should be manipulated), the include key (fields included are the only ones to be manipulated, or the exclude key (all fields except those included are the ones to be manipulated).

realistic_dummy_content_api_user_insert() defines the array ('exclude' => array(picture)) whereas realistic_dummy_content_api_user_presave() defines the array ('include' => array(picture)). Therefore taken together these two hooks manipulate the entire user object, but in two phases.

This allows hook implementations to return a different class based on the type of filter.

Return value

Array of objects which are a subclass of RealisticDummyContentBase.

1 function implements hook_realistic_dummy_content_api_class()

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

realistic_dummy_content_api_realistic_dummy_content_api_class in api/realistic_dummy_content_api.module
Implements hook_realistic_dummy_content_api_class().
1 invocation of hook_realistic_dummy_content_api_class()
realistic_dummy_content_api_improve_dummy_content in api/realistic_dummy_content_api.module
Insert or improve dummy data in an entity of a given type.


api/realistic_dummy_content_api.api.php, line 71
Hook definitions. These functions are never called, and are included here for documentation purposes only.


function hook_realistic_dummy_content_api_class($entity, $type, $filter = array()) {
  return array(
    // Insert class names for all classes which can modify entities for the
    // given type. These classes must exist, either through Drupal's
    // autoload system or be included explictely, and they must be
    // subclasses of RealisticDummyContentBase