将 Moodle php single_button 转换为 link
convert Moodle php single_button to a link
我需要更改以下代码以将按钮替换为可点击的按钮 link
像
课程 >
基本上我仍然会使用生成的 link 但我需要它而不是按钮,而是 link 按钮。这样用户可以在需要时单击鼠标中键并在不同的选项卡中打开它。
if (has_capability('block/progress:overview', $this->context)) {
$parameters = array('progressbarid' => $this->instance->id, 'courseid' => $COURSE->id);
$url = new moodle_url('/blocks/progress/overview.php', $parameters);
$label = get_string('overview', 'block_progress');
$options = array('class' => 'overviewButton');
$this->content->text .= $OUTPUT->single_button($url, $label, 'post', $options);
}
它是我需要更改的 single_button 元素。
请帮忙。
替换这个
$this->content->text .= $OUTPUT->single_button($url, $label, 'post', $options);
有了这个
$this->content->text .= html_writer::link($url, $label);
谢谢拉塞尔。我只是像这样添加了 class:
$this->content->text .= html_writer::link($url, $label,array('class' => 'btn btn-secondary'));
感谢您的帮助。
我需要更改以下代码以将按钮替换为可点击的按钮 link
像
课程 >
基本上我仍然会使用生成的 link 但我需要它而不是按钮,而是 link 按钮。这样用户可以在需要时单击鼠标中键并在不同的选项卡中打开它。
if (has_capability('block/progress:overview', $this->context)) {
$parameters = array('progressbarid' => $this->instance->id, 'courseid' => $COURSE->id);
$url = new moodle_url('/blocks/progress/overview.php', $parameters);
$label = get_string('overview', 'block_progress');
$options = array('class' => 'overviewButton');
$this->content->text .= $OUTPUT->single_button($url, $label, 'post', $options);
}
它是我需要更改的 single_button 元素。 请帮忙。
替换这个
$this->content->text .= $OUTPUT->single_button($url, $label, 'post', $options);
有了这个
$this->content->text .= html_writer::link($url, $label);
谢谢拉塞尔。我只是像这样添加了 class:
$this->content->text .= html_writer::link($url, $label,array('class' => 'btn btn-secondary'));
感谢您的帮助。