Actions

ContentLanguage form field type

From Joomla! Documentation

Revision as of 07:07, 16 September 2013 by Sovainfo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Provides a list of content languages..

  • name (mandatory) is the unique name of the parameter.
  • type (mandatory) must be moduleorder.
  • label (mandatory) is the descriptive title of the field.
  • description (optional) 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>
                ');
        }
}