You are here

function hook_realistic_dummy_content_attribute_manipulator_alter in Realistic Dummy Content 8.2

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

Returns a manipulator class name for a given field.


string $class: A class name to alter.

array $info: More information which may be required for the manipulator class. This can contain [ machine_name => The machine name of a field type. entity => Drupal entity object, field_name => the field name ], which can be required for example to determine which type of entity reference manipulator to create.

1 function implements hook_realistic_dummy_content_attribute_manipulator_alter()

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_attribute_manipulator_alter in api/realistic_dummy_content_api.module
Implements hook_realistic_dummy_content_attribute_manipulator_alter().
1 invocation of hook_realistic_dummy_content_attribute_manipulator_alter()
RealisticDummyContentFieldModifier::addModifier in api/src/includes/RealisticDummyContentFieldModifier.php
Adds a modifier to a list of attribute modifiers.


api/realistic_dummy_content_api.api.php, line 27
Hook definitions for documentation purposes.


function hook_realistic_dummy_content_attribute_manipulator_alter(&$class, &$info) {
  $type = isset($info['type']) ? $info['type'] : NULL;
  $machine_name = isset($info['machine_name']) ? $info['machine_name'] : NULL;
  $entity = isset($info['entity']) ? $info['entity'] : NULL;
  $field_name = isset($info['field_name']) ? $info['field_name'] : NULL;

  // If you want to implement a particular manipulator class for a field or
  // property you can do so by implementing this hook and reproducing what's
  // below for your own field or property type.
  switch (Framework::instance()
    ->fieldTypeMachineName($info)) {
    case 'picture':

      // The user picture.
      $class = '\\Drupal\\realistic_dummy_content_api\\includes\\RealisticDummyContentUserPicture';
    case 'text_with_summary':

      // For example the body.
      $class = '\\Drupal\\realistic_dummy_content_api\\includes\\RealisticDummyContentTextWithSummaryField';
    case 'taxonomy_term_reference':

      // For example, tags on articles.
      $class = '\\Drupal\\realistic_dummy_content_api\\includes\\RealisticDummyContentTermReferenceField';
    case 'image':

      // For example, images on articles.
      $class = '\\Drupal\\realistic_dummy_content_api\\includes\\RealisticDummyContentImageField';