You are here

public function i18n_string_object::get_source in Internationalization 7

Get source string provided a string object.

Return value

String object if source exists.

File

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

Class

i18n_string_object
String object that contains source and translations.

Code

public function get_source() {

  // If already searched and not found we don't have a source,
  if (isset($this->lid) && !$this->lid) {
    return NULL;
  }
  elseif (!isset($this->lid) || !isset($this->source)) {

    // We may have lid from loading a translation but not loaded the source yet.
    if ($source = $this
      ->textgroup()
      ->load_source($this)) {

      // Set properties but don't override existing ones
      $this
        ->set_properties($source, FALSE, FALSE);
      if (!isset($this->string)) {
        $this->string = $source->source;
      }
      return $this;
    }
    else {
      $this->lid = FALSE;
      return NULL;
    }
  }
  else {
    return $this;
  }
}