#52 Fixed appearance of colour picker in Boost
This commit is contained in:
parent
f3f9fef1a4
commit
6fb3230e54
1 changed files with 29 additions and 4 deletions
|
@ -16,7 +16,8 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
|
||||
|
||||
require_once("HTML/QuickForm/text.php");
|
||||
require_once($CFG->dirroot . '/lib/form/editor.php');
|
||||
require_once($CFG->dirroot . '/lib/form/templatable_form_element.php');
|
||||
|
||||
/**
|
||||
* Form element for handling the colour picker.
|
||||
|
@ -25,7 +26,10 @@ require_once("HTML/QuickForm/text.php");
|
|||
* @copyright 2013 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class MoodleQuickForm_customcert_colourpicker extends HTML_QuickForm_text {
|
||||
class MoodleQuickForm_customcert_colourpicker extends MoodleQuickForm_editor {
|
||||
use templatable_form_element {
|
||||
export_for_template as export_for_template_base;
|
||||
}
|
||||
|
||||
/**
|
||||
* The string for the help icon, if empty then no help icon will be displayed.
|
||||
|
@ -39,7 +43,7 @@ class MoodleQuickForm_customcert_colourpicker extends HTML_QuickForm_text {
|
|||
* @param string $elementLabel
|
||||
* @param array $attributes
|
||||
*/
|
||||
function __construct($elementName = null, $elementLabel = null, $attributes = null) {
|
||||
public function __construct($elementName = null, $elementLabel = null, $attributes = null) {
|
||||
parent::__construct($elementName, $elementLabel, $attributes);
|
||||
}
|
||||
|
||||
|
@ -50,10 +54,24 @@ class MoodleQuickForm_customcert_colourpicker extends HTML_QuickForm_text {
|
|||
* @param string $elementLabel
|
||||
* @param array $attributes
|
||||
*/
|
||||
function MoodleQuickForm_customcert_colourpicker($elementName = null, $elementLabel = null, $attributes = null) {
|
||||
public function MoodleQuickForm_customcert_colourpicker($elementName = null, $elementLabel = null, $attributes = null) {
|
||||
self::__construct($elementName, $elementLabel, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the form element
|
||||
*/
|
||||
public function setValue($value) {
|
||||
$this->updateAttributes(array('value' => $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the form element
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->getAttribute('value');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html string to display this element.
|
||||
*
|
||||
|
@ -82,4 +100,11 @@ class MoodleQuickForm_customcert_colourpicker extends HTML_QuickForm_text {
|
|||
public function getHelpButton(){
|
||||
return $this->_helpbutton;
|
||||
}
|
||||
|
||||
public function export_for_template(renderer_base $output) {
|
||||
$context = $this->export_for_template_base($output);
|
||||
$context['html'] = $this->toHtml();
|
||||
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue