Difference between revisions of "ContentLanguage form field type"

From Joomla! Documentation

m (Fix syntax error and add highlighting)
(Added deprecation notice and link to Joomla Manual)
 
Line 1: Line 1:
 
<noinclude><languages /></noinclude>
 
<noinclude><languages /></noinclude>
 +
{{Warning|This page has been superseded and is no longer maintained. Please go to [https://manual.joomla.org/docs/general-concepts/forms-fields/standard-fields/contentlanguage Joomla Manual ContentLanguage Field] instead}}
 +
 
<translate><!--T:1-->
 
<translate><!--T:1-->
 
Provides a list of content languages.</translate>
 
Provides a list of content languages.</translate>

Latest revision as of 17:23, 15 July 2024

Other languages:
English • ‎Nederlands • ‎español • ‎français
Stop hand nuvola.svg.png
Warning!

This page has been superseded and is no longer maintained. Please go to Joomla Manual ContentLanguage Field instead


Provides a list of content languages.

  • name (mandatory) is the unique name of the parameter.
  • type (mandatory) must be contentlanguage.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • description (optional) (translatable) tooltip for the form field.

Example XML Definition from plugins/system/languagecode/languagecode.php

if ($languages = JLanguage::getKnownLanguages(JPATH_SITE))
{
	// Inject fields into the form
	foreach ($languages as $tag => $language)
	{
		$form->load('
			<form>
				<fields name="params">
					<fieldset
						name="languagecode"
						label="PLG_SYSTEM_LANGUAGECODE_FIELDSET_LABEL"
						description="PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC"
					>
						<field
							name="'.strtolower($tag).'"
							type="text"
							description="' . htmlspecialchars(JText::sprintf('PLG_SYSTEM_LANGUAGECODE_FIELD_DESC', $language['name']), ENT_COMPAT, 'UTF-8') . '"
							translate_description="false"
							label="' . $tag . '"
							translate_label="false"
							size="7"
							filter="cmd"
						/>
					</fieldset>
				</fields>
			</form>
		');
	}
}