/** * Which of the (possibly several) names of this record is the primary one. * * @return int */ public function getPrimaryName() { static $language_script; if ($language_script === null) { $language_script = I18N::languageScript(WT_LOCALE); } if ($this->_getPrimaryName === null) { // Generally, the first name is the primary one.... $this->_getPrimaryName = 0; // ...except when the language/name use different character sets if (count($this->getAllNames()) > 1) { foreach ($this->getAllNames() as $n => $name) { if ($name['type'] !== '_MARNM' && I18N::textScript($name['sort']) === $language_script) { $this->_getPrimaryName = $n; break; } } } } return $this->_getPrimaryName; }