diff --git a/edit_form.php b/edit_form.php index bcdb416..19e0b79 100644 --- a/edit_form.php +++ b/edit_form.php @@ -226,6 +226,13 @@ class mod_customcert_edit_form extends moodleform { $group[] = $mform->createElement('submit', 'addelement_' . $pageid, get_string('addelement', 'customcert')); $mform->addElement('group', 'elementgroup', '', $group, '', false); + // Add option to delete this page if it is not the first page. + if ($pagenum > 1) { + $mform->addElement('html', html_writer::start_tag('div', array('class' => 'deletecertpage'))); + $mform->addElement('submit', 'deletecertpage_' . $pageid, get_string('deletecertpage', 'customcert')); + $mform->addElement('html', html_writer::end_tag('div')); + } + // Check if there are elements to add. if ($elements = $DB->get_records('customcert_elements', array('pageid' => $pageid), 'id ASC')) { // Loop through and add the ones present. @@ -247,12 +254,5 @@ class mod_customcert_edit_form extends moodleform { } } } - - // Add option to delete this page if it is not the first page. - if ($pagenum > 1) { - $mform->addElement('html', html_writer::start_tag('div', array('class' => 'deletecertpage'))); - $mform->addElement('submit', 'deletecertpage_' . $pageid, get_string('deletecertpage', 'customcert')); - $mform->addElement('html', html_writer::end_tag('div')); - } } }