You are here

protected function i18n_string_object_wrapper::build_properties in Internationalization 7

Build properties from object.

5 calls to i18n_string_object_wrapper::build_properties()
i18n_block_object::build_properties in i18n_block/i18n_block.inc
Get object strings for translation
i18n_field::build_properties in i18n_field/i18n_field.inc
Get translatable properties
i18n_field_instance::build_properties in i18n_field/i18n_field.inc
Get translatable properties
i18n_menu_link::build_properties in i18n_menu/i18n_menu.inc
Get translatable properties.
i18n_string_object_wrapper::get_properties in i18n_string/i18n_string.inc
Get object translatable properties
4 methods override i18n_string_object_wrapper::build_properties()
i18n_block_object::build_properties in i18n_block/i18n_block.inc
Get object strings for translation
i18n_field::build_properties in i18n_field/i18n_field.inc
Get translatable properties
i18n_field_instance::build_properties in i18n_field/i18n_field.inc
Get translatable properties
i18n_menu_link::build_properties in i18n_menu/i18n_menu.inc
Get translatable properties.

File

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

Class

i18n_string_object_wrapper
String object wrapper

Code

protected function build_properties() {
  list($string_type, $object_id) = $this
    ->get_string_context();
  $object_keys = array(
    $this
      ->get_textgroup(),
    $string_type,
    $object_id,
  );
  $strings = array();
  foreach ($this
    ->get_string_info('properties', array()) as $field => $info) {
    $info = is_array($info) ? $info : array(
      'title' => $info,
    );
    $field_name = isset($info['field']) ? $info['field'] : $field;
    $value = $this
      ->get_field($field_name);
    if (is_array($value) && isset($value['value'])) {
      $format = isset($value['format']) ? $value['format'] : NULL;
      $value = $value['value'];
    }
    else {
      $format = isset($info['format']) ? $this
        ->get_field($info['format']) : NULL;
    }
    $strings[$this
      ->get_textgroup()][$string_type][$object_id][$field] = array(
      'string' => is_array($value) || isset($info['empty']) && $value === $info['empty'] ? NULL : $value,
      'title' => $info['title'],
      'format' => $format,
      'name' => array_merge($object_keys, array(
        $field,
      )),
    );
  }
  return $strings;
}