public function toHtml() {
        global $PAGE;

        $html = parent::toHTML();

        if (!$this->isFrozen()) {
            $context = context_system::instance();
            $params = [$context->id];
            // Require some JS to select the competencies.
            $PAGE->requires->js_call_amd('tool_lp/form_competency_element', 'init', $params);
            $html .= '<div class="form-group row">';
            $html .= '<div class="col-md-3"></div>';
            $html .= '<div class="col-md-9">';
            $html .= '<div data-region="competencies"></div>';
            $html .= '<div class="mt-3">';
            $html .= '<a class="btn btn-secondary" role="button" data-action="select-competencies">';
            $html .= get_string('addcompetency', 'tool_lp');
            $html .= '</a>';
            $html .= '</div>';
            $html .= '</div>';
            $html .= '</div>';
        }
        return $html;
    }