/contentmanager/code/trunk/administrator/components/com_contentmanager/libraries/jxtended/form/fields/color.php
PHP | 51 lines | 22 code | 8 blank | 21 comment | 1 complexity | cd20c2ee7d5888a55fa3b9b79345f31e MD5 | raw file
- <?php
- /**
- * @version $Id: color.php 160 2009-07-09 00:06:09Z eddieajau $
- * @package JXtended.Libraries
- * @subpackage Form
- * @copyright Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
- * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
- * @link http://jxtended.com
- */
- defined('JPATH_BASE') or die;
- jimport('joomla.html.html');
- jximport2('jxtended.form.field');
- jximport2('jxtended.form.fields.text');
- /**
- * JXtended Form Field Type Class for a color input.
- *
- * @package JXtended.Libraries
- * @subpackage Form
- * @version 1.0
- */
- class JXFieldTypeColor extends JXFieldTypeText
- {
- /**
- * Field type
- *
- * @access protected
- * @var string
- */
- var $_type = 'Color';
- function fetchField($name, $value, &$node, $controlName)
- {
- static $init = null;
- if (!$init) {
- JHtml::script('color.js', 'plugins/system/jxtended/form/assets/js/');
- $init = true;
- }
- $pickerId = str_replace(']', '', str_replace('[', '_', $controlName.'_'.$name)).'-picker';
- $node->addAttribute('onchange', 'relateColor(\''.$pickerId.'\', this.value);');
- $html = parent::fetchField($name, $value, &$node, $controlName);
- $html .= ' <button type="button" onclick="pickColor(\''.$pickerId.'\')" id="'.$pickerId.'" class="color-picker">...</div>';
- return $html;
- }
- }