1 <?php
 2 /**
 3  * @package     Joomla.Platform
 4  * @subpackage  Form
 5  *
 6  * @copyright   Copyright (C) 2005 - 2017 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 JFormHelper::loadFieldClass('list');
13 
14 /**
15  * Form Field class for the Joomla Platform.
16  * Provides a list of available cache handlers
17  *
18  * @see    JCache
19  * @since  11.1
20  */
21 class JFormFieldCacheHandler extends JFormFieldList
22 {
23     /**
24      * The form field type.
25      *
26      * @var    string
27      * @since  11.1
28      */
29     protected $type = 'CacheHandler';
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         $options = array();
41 
42         // Convert to name => name array.
43         foreach (JCache::getStores() as $store)
44         {
45             $options[] = JHtml::_('select.option', $store, JText::_('JLIB_FORM_VALUE_CACHE_' . $store), 'value', 'text');
46         }
47 
48         $options = array_merge(parent::getOptions(), $options);
49 
50         return $options;
51     }
52 }
53