Added ability to edit an element on the rearrange page
Increased the Moodle version required as this feature uses the AMD module 'core/fragment' which was introduced in 3.1.
This commit is contained in:
parent
65aee9c9c0
commit
555bca9ebb
13 changed files with 510 additions and 15 deletions
|
@ -44,14 +44,19 @@ class edit_element_form extends \moodleform {
|
|||
public function definition() {
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->updateAttributes(array('id' => 'editelementform'));
|
||||
|
||||
$element = $this->_customdata['element'];
|
||||
|
||||
// Add the field for the name of the element, this is required for all elements.
|
||||
$mform->addElement('text', 'name', get_string('elementname', 'customcert'));
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
$mform->setDefault('name', get_string('pluginname', 'customcertelement_' . $element->element));
|
||||
$mform->addRule('name', get_string('required'), 'required', null, 'client');
|
||||
$mform->addHelpButton('name', 'elementname', 'customcert');
|
||||
// Do not display the name if we are on the rearrange page.
|
||||
if (!isset($this->_customdata['rearrange'])) {
|
||||
// Add the field for the name of the element, this is required for all elements.
|
||||
$mform->addElement('text', 'name', get_string('elementname', 'customcert'));
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
$mform->setDefault('name', get_string('pluginname', 'customcertelement_' . $element->element));
|
||||
$mform->addRule('name', get_string('required'), 'required', null, 'client');
|
||||
$mform->addHelpButton('name', 'elementname', 'customcert');
|
||||
}
|
||||
|
||||
$this->element = \mod_customcert\element::instance($element);
|
||||
$this->element->render_form_elements($mform);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue