mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Merge branch 'MDL-30845-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
commit
af6b7edaee
@ -64,6 +64,33 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{
|
||||
$this->_hiddenLabel = $hiddenLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Freeze the element so that only its value is returned and set persistantfreeze to false
|
||||
*
|
||||
* @since 2.4
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function freeze()
|
||||
{
|
||||
$this->_flagFrozen = true;
|
||||
// No hidden element is needed refer MDL-30845
|
||||
$this->setPersistantFreeze(false);
|
||||
} //end func freeze
|
||||
|
||||
/**
|
||||
* Returns the html to be used when the element is frozen
|
||||
*
|
||||
* @since 2.4
|
||||
* @return string Frozen html
|
||||
*/
|
||||
function getFrozenHtml()
|
||||
{
|
||||
$attributes = array('readonly' => 'readonly');
|
||||
$this->updateAttributes($attributes);
|
||||
return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />' . $this->_getPersistantData();
|
||||
} //end func getFrozenHtml
|
||||
|
||||
/**
|
||||
* Returns HTML for this form element.
|
||||
*
|
||||
@ -88,18 +115,4 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{
|
||||
return $this->_helpbutton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slightly different container template when frozen. Don't want to use a label tag
|
||||
* with a for attribute in that case for the element label but instead use a div.
|
||||
* Templates are defined in renderer constructor.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getElementTemplateType(){
|
||||
if ($this->_flagFrozen){
|
||||
return 'static';
|
||||
} else {
|
||||
return 'default';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,6 @@ class qtype_numerical_edit_form extends question_edit_form {
|
||||
$firstunit = $mform->getElement('multiplier[0]');
|
||||
$firstunit->freeze();
|
||||
$firstunit->setValue('1.0');
|
||||
$firstunit->setPersistantFreeze(true);
|
||||
$mform->addHelpButton('multiplier[0]', 'numericalmultiplier', 'qtype_numerical');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user