You are here

function lingotek_load_profile_defaults in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_load_profile_defaults()
  2. 7.4 lingotek.util.inc \lingotek_load_profile_defaults()
  3. 7.6 lingotek.util.inc \lingotek_load_profile_defaults()

Gets the default profile info, mapped by entity type

3 calls to lingotek_load_profile_defaults()
lingotek_entity_load in ./lingotek.module
Implements hook_entity_load().
lingotek_entity_save in ./lingotek.module
lingotek_profile_condition in ./lingotek.util.inc

File

./lingotek.util.inc, line 1070
Utility functions.

Code

function lingotek_load_profile_defaults($entity_type) {
  $profile_defaults = lingotek_get_profiles();
  $entity_profile_defaults = variable_get('lingotek_entity_profiles', array());
  $profile_map = array();
  if (array_key_exists($entity_type, $entity_profile_defaults)) {
    foreach ($entity_profile_defaults[$entity_type] as $k => $v) {
      $profile_map[$k] = is_numeric($v) ? $profile_defaults[$v] : array();
      $profile_map[$k]['profile'] = $v;
      unset($profile_map[$k]['name']);
    }
    return $profile_map;
  }
  return array();
}