[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Form/Field/ -> SessionhandlerField.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Form\Field;
  11  
  12  use Joomla\CMS\HTML\HTMLHelper;
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\Session\Session;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('JPATH_PLATFORM') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Form Field class for the Joomla Platform.
  22   * Provides a select list of session handler options.
  23   *
  24   * @since  1.7.0
  25   */
  26  class SessionhandlerField extends ListField
  27  {
  28      /**
  29       * The form field type.
  30       *
  31       * @var    string
  32       * @since  1.7.0
  33       */
  34      protected $type = 'Sessionhandler';
  35  
  36      /**
  37       * Method to get the session handler field options.
  38       *
  39       * @return  array  The field option objects.
  40       *
  41       * @since   1.7.0
  42       */
  43      protected function getOptions()
  44      {
  45          $options = array();
  46  
  47          // Get the options from the session object.
  48          foreach (Session::getHandlers() as $store) {
  49              $options[] = HTMLHelper::_('select.option', strtolower($store), Text::_('JLIB_FORM_VALUE_SESSION_' . $store), 'value', 'text');
  50          }
  51  
  52          // Merge any additional options in the XML definition.
  53          $options = array_merge(parent::getOptions(), $options);
  54  
  55          return $options;
  56      }
  57  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer