[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_languages 6 * 7 * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Languages\Administrator\Field; 12 13 use Joomla\CMS\Form\Field\ListField; 14 use Joomla\CMS\Language\LanguageHelper; 15 use Joomla\CMS\Language\Text; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Client Language List field. 23 * 24 * @since 3.9.0 25 */ 26 class LanguageclientField extends ListField 27 { 28 /** 29 * The form field type. 30 * 31 * @var string 32 * @since 3.9.0 33 */ 34 protected $type = 'Languageclient'; 35 36 /** 37 * Cached form field options. 38 * 39 * @var array 40 * @since 3.9.0 41 */ 42 protected $cache = array(); 43 44 /** 45 * Method to get the field options. 46 * 47 * @return array The field option objects. 48 * 49 * @since 3.9.0 50 */ 51 protected function getOptions() 52 { 53 // Try to load the data from our mini-cache. 54 if (!empty($this->cache)) { 55 return $this->cache; 56 } 57 58 // Get all languages of frontend and backend. 59 $languages = array(); 60 $site_languages = LanguageHelper::getKnownLanguages(JPATH_SITE); 61 $admin_languages = LanguageHelper::getKnownLanguages(JPATH_ADMINISTRATOR); 62 63 // Create a single array of them. 64 foreach ($site_languages as $tag => $language) { 65 $languages[$tag . '0'] = Text::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], Text::_('JSITE')); 66 } 67 68 foreach ($admin_languages as $tag => $language) { 69 $languages[$tag . '1'] = Text::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], Text::_('JADMINISTRATOR')); 70 } 71 72 // Sort it by language tag and by client after that. 73 ksort($languages); 74 75 // Add the languages to the internal cache. 76 $this->cache = array_merge(parent::getOptions(), $languages); 77 78 return $this->cache; 79 } 80 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |