You are here

public function i18n_string_object::set_properties in Internationalization 7

Set properties from object or array

Parameters

$properties: Obejct or array of properties

$set_null: Whether to set null properties too

$override: Whether to set properties that are already set in this object

4 calls to i18n_string_object::set_properties()
i18n_string_object::get_source in i18n_string/i18n_string.inc
Get source string provided a string object.
i18n_string_object::rebuild_from_cache in i18n_string/i18n_string.inc
Rebuild the object data based on the persistent cache.
i18n_string_object::set_translation in i18n_string/i18n_string.inc
Set translation for language
i18n_string_object::__construct in i18n_string/i18n_string.inc
Class constructor

File

i18n_string/i18n_string.inc, line 276
API for internationalization strings

Class

i18n_string_object
String object that contains source and translations.

Code

public function set_properties($properties, $set_null = TRUE, $override = TRUE) {
  foreach ((array) $properties as $field => $value) {
    if (property_exists($this, $field) && ($set_null || isset($value)) && ($override || !isset($this->{$field}))) {
      $this->{$field} = $value;
    }
  }
  return $this;
}