You are here

function hook_flexiform_entity_getter_info in Flexiform 7

Register entity getters/setters with the flexiform system.

Entity getters are used by flexiform to load entities into the flexiform.

Return value

An array of getter definitions keyed by a unique getter name. Each definition should have the following keys:

  • label (required): A human readable name for the getter
  • description: A Description of the getter
  • entity_types (required): An array of entity types this getter can return
  • file: Which file is the getter in
  • params: An array of parameters for the getter keyed by variable name with the following keys:

    • entity_type: What type of entity to expect
  • getter callback: the name of the function to call for the getter (defaults to flexiform_entity_getter_GETTER_NAME)
  • setter callback: the name of the function to call to save the entity
1 function implements hook_flexiform_entity_getter_info()

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

flexiform_flexiform_entity_getter_info in ./flexiform.flexiform.inc
Implements hook_flexiform_entity_getter_info().
1 invocation of hook_flexiform_entity_getter_info()
flexiform_entity_getter_info in ./flexiform.module
Get info about all entity getters

File

./flexiform.api.php, line 275
API documentation for Flexiform.

Code

function hook_flexiform_entity_getter_info() {
  $getters = array();

  // Base entity getter.
  $getters['base_entity'] = array(
    'label' => 'Base Entity',
    'description' => 'The Base Entity for this Flexiform',
    'entity_types' => array_keys(entity_get_info()),
    'file' => 'includes/flexiform.flexiform.inc',
  );

  // User Getters
  $getters['user_current_user'] = array(
    'label' => 'Current User',
    'description' => 'Load the current user into the Form',
    'entity_types' => array(
      'user',
    ),
    'file' => 'user.flexiform.inc',
  );

  // Profile2 Getters
  if (module_exists('profile2')) {
    $getters['profile2_profile_from_user'] = array(
      'label' => 'Profile2 from User',
      'description' => 'Load a Profile 2 Basede on a User',
      'params' => array(
        'user' => array(
          'entity_type' => 'user',
        ),
      ),
      'entity_types' => array(
        'profile2',
      ),
      'file' => 'profile2.flexiform.inc',
    );
  }
  return $getters;
}