[ 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_actionlogs 6 * 7 * @copyright (C) 2018 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\Actionlogs\Administrator\Field; 12 13 use Joomla\CMS\Form\Field\ListField; 14 use Joomla\CMS\HTML\HTMLHelper; 15 use Joomla\CMS\Language\Text; 16 use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Field to load a list of all extensions that have logged actions 24 * 25 * @since 3.9.0 26 */ 27 class ExtensionField extends ListField 28 { 29 /** 30 * The form field type. 31 * 32 * @var string 33 * @since 3.9.0 34 */ 35 protected $type = 'extension'; 36 37 /** 38 * Method to get the options to populate list 39 * 40 * @return array The field option objects. 41 * 42 * @since 3.9.0 43 */ 44 public function getOptions() 45 { 46 $db = $this->getDatabase(); 47 $query = $db->getQuery(true) 48 ->select('DISTINCT ' . $db->quoteName('extension')) 49 ->from($db->quoteName('#__action_logs')) 50 ->order($db->quoteName('extension')); 51 52 $db->setQuery($query); 53 $context = $db->loadColumn(); 54 55 $options = array(); 56 57 if (\count($context) > 0) { 58 foreach ($context as $item) { 59 $extensions[] = strtok($item, '.'); 60 } 61 62 $extensions = array_unique($extensions); 63 64 foreach ($extensions as $extension) { 65 ActionlogsHelper::loadTranslationFiles($extension); 66 $options[] = HTMLHelper::_('select.option', $extension, Text::_($extension)); 67 } 68 } 69 70 return array_merge(parent::getOptions(), $options); 71 } 72 }
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 |