Source for file language.php

Documentation is available at language.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Form
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12.  
  13. /**
  14.  * Form Field class for the Joomla Platform.
  15.  * Supports a list of installed application languages
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Form
  19.  * @see         JFormFieldContentLanguage for a select list of content languages.
  20.  * @since       11.1
  21.  */
  22. {
  23.     /**
  24.      * The form field type.
  25.      *
  26.      * @var    string 
  27.      * @since  11.1
  28.      */
  29.     protected $type = 'Language';
  30.  
  31.     /**
  32.      * Method to get the field options.
  33.      *
  34.      * @return  array  The field option objects.
  35.      *
  36.      * @since   11.1
  37.      */
  38.     protected function getOptions()
  39.     {
  40.         // Initialize some field attributes.
  41.         $client = (string) $this->element['client'];
  42.  
  43.         if ($client != 'site' && $client != 'administrator')
  44.         {
  45.             $client 'site';
  46.         }
  47.  
  48.         // Merge any additional options in the XML definition.
  49.         $options array_merge(
  50.             parent::getOptions(),
  51.             JLanguageHelper::createLanguageList($this->valueconstant('JPATH_' strtoupper($client))truetrue)
  52.         );
  53.  
  54.         // Set the default value active language
  55.         if ($langParams JComponentHelper::getParams('com_languages'))
  56.         {
  57.             switch ((string) $this->value)
  58.             {
  59.                 case 'site':
  60.                 case 'frontend':
  61.                 case '0':
  62.                     $this->value = $langParams->get('site''en-GB');
  63.                     break;
  64.                 case 'admin':
  65.                 case 'administrator':
  66.                 case 'backend':
  67.                 case '1':
  68.                     $this->value = $langParams->get('administrator''en-GB');
  69.                     break;
  70.                 case 'active':
  71.                 case 'auto':
  72.                     $lang JFactory::getLanguage();
  73.                     $this->value = $lang->getTag();
  74.                     break;
  75.                 default:
  76.                 break;
  77.             }
  78.         }
  79.  
  80.         return $options;
  81.     }
  82. }

Documentation generated on Tue, 19 Nov 2013 15:06:32 +0100 by phpDocumentor 1.4.3