Actions

Difference between revisions of "ContentLanguage form field type"

From Joomla! Documentation

(new document)
 
m (type text instead of moduleorder)
 
Line 2: Line 2:
  
 
* '''name''' (mandatory) is the unique name of the parameter.
 
* '''name''' (mandatory) is the unique name of the parameter.
* '''type''' (mandatory) must be ''moduleorder''.
+
* '''type''' (mandatory) must be ''text''.
 
* '''label''' (mandatory) is the descriptive title of the field.
 
* '''label''' (mandatory) is the descriptive title of the field.
 
* '''description''' (optional) tooltip for the form field.
 
* '''description''' (optional) tooltip for the form field.

Latest revision as of 07:08, 16 September 2013

Provides a list of content languages..

  • name (mandatory) is the unique name of the parameter.
  • type (mandatory) must be text.
  • 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>
                ');
        }
}