PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/libraries/jxtended/form/fields/color.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 51 lines | 22 code | 8 blank | 21 comment | 1 complexity | cd20c2ee7d5888a55fa3b9b79345f31e MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: color.php 160 2009-07-09 00:06:09Z eddieajau $
  4. * @package JXtended.Libraries
  5. * @subpackage Form
  6. * @copyright Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
  7. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  8. * @link http://jxtended.com
  9. */
  10. defined('JPATH_BASE') or die;
  11. jimport('joomla.html.html');
  12. jximport2('jxtended.form.field');
  13. jximport2('jxtended.form.fields.text');
  14. /**
  15. * JXtended Form Field Type Class for a color input.
  16. *
  17. * @package JXtended.Libraries
  18. * @subpackage Form
  19. * @version 1.0
  20. */
  21. class JXFieldTypeColor extends JXFieldTypeText
  22. {
  23. /**
  24. * Field type
  25. *
  26. * @access protected
  27. * @var string
  28. */
  29. var $_type = 'Color';
  30. function fetchField($name, $value, &$node, $controlName)
  31. {
  32. static $init = null;
  33. if (!$init) {
  34. JHtml::script('color.js', 'plugins/system/jxtended/form/assets/js/');
  35. $init = true;
  36. }
  37. $pickerId = str_replace(']', '', str_replace('[', '_', $controlName.'_'.$name)).'-picker';
  38. $node->addAttribute('onchange', 'relateColor(\''.$pickerId.'\', this.value);');
  39. $html = parent::fetchField($name, $value, &$node, $controlName);
  40. $html .= ' <button type="button" onclick="pickColor(\''.$pickerId.'\')" id="'.$pickerId.'" class="color-picker">...</div>';
  41. return $html;
  42. }
  43. }