Moodle - 在表单字段之间插入 html

Moodle - Insert html in between form fields

场景:-

在 Moodle 中,我已经创建了一个使用

的表单
$mform->addElement('hidden', 'category', $category->id);

为表单插入字段。

我想在表格中间插入一个table。

例如。 我有一个表单,其中包含字段用户名、员工代码和联系电话。 我想在 emp 代码和联系人姓名之间插入一个 table。 此 table 将包含用户输入的数据。

我有一种方法可以使用 :-

在页面末尾插入 table
echo $OUTPUT->header();
echo $OUTPUT->heading($pagedesc);
$table = new html_table();
$table->head = array('Name', 'Emp Code','Contact number');
echo html_writer::start_tag('div', array('class'=>'no-overflow'));
echo html_writer::table($table);
echo html_writer::end_tag('div');
echo $OUTPUT->footer();

请建议一种在表格中间插入 table 的方法。

您可以添加 html 作为表单元素 - https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#html

$mform->addElement('html', $output);