You are here

function flexiform_entity_getter_info in Flexiform 7

Get info about all entity getters

3 calls to flexiform_entity_getter_info()
FlexiformFormEntityManagerDefault::getEntityGetterInfo in includes/flexiform.form_entity_manager.inc
Get an entities getter info.
flexiform_entity_type_get_getters in ./flexiform.module
Get the getters for a particular entity type
flexiform_manage_form_entities_form in ./flexiform.admin.inc
flexiform_manage_form_entities_form

File

./flexiform.module, line 560
Module for the Flexiform system.

Code

function flexiform_entity_getter_info($getter = NULL) {
  $getters =& drupal_static(__FUNCTION__);
  if (!isset($getters)) {
    if ($cache = cache_get('flexiform:entity_getter_info', 'cache')) {
      $getters = $cache->data;
    }
    else {
      $getters = array();
      foreach (module_implements('flexiform_entity_getter_info') as $module) {

        // Due to http://drupal.org/node/890660 we can't use module_invoke_all()
        // because we need to know the provenance of each set.
        $getters_module = module_invoke($module, 'flexiform_entity_getter_info');
        foreach ($getters_module as $getter_name => $getter_info) {
          $getter_info += array(
            'params' => array(),
            'module' => $module,
          );
          if (!isset($getter_info['class'])) {
            $getter_info['class'] = 'FlexiformFormEntityLegacy';
            $getter_info += array(
              'getter callback' => 'flexiform_entity_getter_' . $getter_name,
              'setter callback' => 'flexiform_entity_setter_' . $getter_name,
              'file' => $module . '.flexiform.inc',
            );
          }
          $getters[$getter_name] = $getter_info;
        }
      }

      // Alter the data sets with hook_party_data_set_info_alter().
      drupal_alter('flexiform_entity_getter_info', $getters);
      cache_set('flexiform:entity_getter_info', $getters);
    }
  }
  if (!empty($getter)) {
    return $getters[$getter];
  }
  return $getters;
}