Back to PhocacartLanguage class

Method renderTitle

public static
renderTitle
(mixed $title = '', mixed $titleLang = '', mixed $titleSuffix = array(), mixed $type = 'order')

Method renderTitle - Source code

/* Static Part */
/* $titleSuffix = array(
       0 => array('title', 'separator', 'starttag', 'endtag));
   */
public static function renderTitle($title = '', $titleLang = '', $titleSuffix = array(), $type = 'order')
{
    $paramsC = PhocacartUtils::getComponentParameters();
    $order_language_variables = $paramsC->get('order_language_variables', 0);
    // No language variables (no translation) for items in order (total items like shipping or payment titles)
    if ($type == 'order' && $order_language_variables == 0) {
        return $title;
    }
    $o = '';
    if ($titleLang != '') {
        $o .= Text::_($titleLang);
        if (!empty($titleSuffix)) {
            foreach ($titleSuffix as $k => $v) {
                $title = isset($v[0]) && $v[0] != '' ? $v[0] : '';
                $separator = isset($v[1]) && $v[1] != '' ? $v[1] : '';
                $startTag = isset($v[2]) && $v[2] != '' ? $v[2] : '';
                $endTag = isset($v[3]) && $v[3] != '' ? $v[3] : '';
                if ($startTag . Text::_($title) . $endTag != '') {
                    $o .= $separator . $startTag . Text::_($title) . $endTag;
                }
            }
        }
    } else {
        // No title raw, render standard title (such includes suffix)
        $o = $title;
    }
    return $o;
}