From 3cc457db266f5a20f3fa9c6e9ebeb9f4d03ed575 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Fri, 14 Aug 2009 05:45:56 +0000 Subject: [PATCH] MDL-19756 Fixed a number of small API issues in components and renderers --- lib/outputcomponents.php | 4 +++- lib/outputrenderers.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 07c515a1bb..e2178809aa 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -232,7 +232,9 @@ class labelled_html_component extends moodle_html_component { $this->label = new html_label(); $this->label->for = $for; if (empty($for)) { - $this->generate_id(); + if (empty($this->id)) { + $this->generate_id(); + } $this->label->for = $this->id; } $this->label->text = $text; diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 05ec985ba8..596167134c 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1799,6 +1799,9 @@ class moodle_core_renderer extends moodle_renderer_base { $field->prepare(); $this->prepare_event_handlers($field); $output = $this->output_start_tag('span', array('class' => "textfield $field->name")); + if (!empty($field->label)) { + $output .= $this->label($field->label); + } $output .= $this->output_empty_tag('input', array( 'type' => 'text', 'name' => $field->name, -- 2.39.5