library/Haste/Util/Salutations.php
public static function createNameByFields($strLanguage, array $arrData)
    {
        if ($strLanguage)
        {
            \Controller::loadLanguageFile('default', $strLanguage, true);
        }

        $strName = '';

        if ($arrData['firstname'])
        {
            $strName = $arrData['firstname'] . ($arrData['lastname'] ? ' ' . $arrData['lastname'] : '');
        }
        elseif ($arrData['lastname'])
        {
            $strName = $arrData['lastname'];
        }

        if ($strName && $arrData['academicTitle'])
        {
            $strName = $arrData['academicTitle'] . ' ' . $strName;
        }

        if ($strName && $arrData['additionalTitle'])
        {
            $strName = $arrData['additionalTitle'] . ' ' . $strName;
        }

        if ($arrData['lastname'] && $arrData['gender'] && ($strLanguage != 'en' || !$arrData['academicTitle']))
        {
            $strGender = $GLOBALS['TL_LANG']['MSC']['haste_plus']['gender' . ($arrData['gender'] == 'female' ? 'Female' : 'Male')];

            $strName = $strGender . ' ' . $strName;
        }

        if ($strLanguage)
        {
            \Controller::loadLanguageFile('default', $GLOBALS['TL_LANGUAGE'], true);
        }

        return $strName;
    }
public static function createNameByFields($strLanguage, array $arrData)
    {
        if ($strLanguage)
        {
            \Controller::loadLanguageFile('default', $strLanguage, true);
        }

        $strName = '';

        if ($arrData['firstname'])
        {
            $strName = $arrData['firstname'] . ($arrData['lastname'] ? ' ' . $arrData['lastname'] : '');
        }
        elseif ($arrData['lastname'])
        {
            $strName = $arrData['lastname'];
        }

        if ($strName && $arrData['academicTitle'])
        {
            $strName = $arrData['academicTitle'] . ' ' . $strName;
        }

        if ($strName && $arrData['additionalTitle'])
        {
            $strName = $arrData['additionalTitle'] . ' ' . $strName;
        }

        if ($arrData['lastname'] && $arrData['gender'] && ($strLanguage != 'en' || !$arrData['academicTitle']))
        {
            $strGender = $GLOBALS['TL_LANG']['MSC']['haste_plus']['gender' . ($arrData['gender'] == 'female' ? 'Female' : 'Male')];

            $strName = $strGender . ' ' . $strName;
        }

        if ($strLanguage)
        {
            \Controller::loadLanguageFile('default', $GLOBALS['TL_LANGUAGE'], true);
        }

        return $strName;
    }
public static function createNameByFields ( $ strLanguage , array $ arrData ) { if ( $ strLanguage ) { \ Controller :: loadLanguageFile ( 'default' , $ strLanguage , true ) ; } $ strName = '' ; if ( $ arrData [ 'firstname' ] ) { $ strName = $ arrData [ 'firstname' ] . ( $ arrData [ 'lastname' ] ? ' ' . $ arrData [ 'lastname' ] : '' ) ; } elseif ( $ arrData [ 'lastname' ] ) { $ strName = $ arrData [ 'lastname' ] ; } if ( $ strName && $ arrData [ 'academicTitle' ] ) { $ strName = $ arrData [ 'academicTitle' ] . ' ' . $ strName ; } if ( $ strName && $ arrData [ 'additionalTitle' ] ) { $ strName = $ arrData [ 'additionalTitle' ] . ' ' . $ strName ; } if ( $ arrData [ 'lastname' ] && $ arrData [ 'gender' ] && ( $ strLanguage != 'en' || ! $ arrData [ 'academicTitle' ] ) ) { $ strGender = $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'haste_plus' ] [ 'gender' . ( $ arrData [ 'gender' ] == 'female' ? 'Female' : 'Male' ) ] ; $ strName = $ strGender . ' ' . $ strName ; } if ( $ strLanguage ) { \ Controller :: loadLanguageFile ( 'default' , $ GLOBALS [ 'TL_LANGUAGE' ] , true ) ; } return $ strName ; }
Creates complete names by inserting an array of the person's data

Supported field names: firstname, lastname, academicTitle, additionalTitle, gender

If some of the fields shouldn't go into the processed name, just leave them out of $arrData

@param array $arrData
Creates complete names by inserting an array of the person s data