Actions

API16

JLanguageHelper/createLanguageList

From Joomla! Documentation

< API16:JLanguageHelper
Revision as of 22:04, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Builds a list of the system languages which can be used in a select option

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

static createLanguageList($actualLanguage, $basePath=JPATH_BASE, $caching=false)
Parameter Name Default Value Description
$actualLanguage Client key for the area
$basePath JPATH_BASE Base path to use
$caching false An array of arrays (text, value, selected)

Defined in

libraries/joomla/language/helper.php

Importing

jimport( 'joomla.language.helper' );

Source Body

public static function createLanguageList($actualLanguage, $basePath = JPATH_BASE, $caching = false)
{
        $list = array ();
 
        // cache activation
        $langs = JLanguage::getKnownLanguages($basePath);
 
        foreach ($langs as $lang => $metadata)
        {
                $option = array ();
 
                $option['text'] = $metadata['name'];
                $option['value'] = $lang;
                if ($lang == $actualLanguage) {
                        $option['selected'] = 'selected="selected"';
                }
                $list[] = $option;
        }
 
        return $list;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />