You are here

function eck_language_property_entity_save in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 plugins/property_behavior/language.inc \eck_language_property_entity_save()

When saving the property, only one language can be set, and only once.

1 string reference to 'eck_language_property_entity_save'
language.inc in plugins/property_behavior/language.inc

File

plugins/property_behavior/language.inc, line 32

Code

function eck_language_property_entity_save($property, $vars) {
  $entity = $vars['entity'];
  if (module_exists('locale')) {
    if (isset($entity->is_new) && $entity->is_new && empty($entity->{$property})) {
      $default = language_default();
      $entity->{$property} = $default->language;
    }
  }
  else {
    $entity->{$property} = LANGUAGE_NONE;
  }
}