]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19756 Fixed a number of small API issues in components and renderers
authornicolasconnault <nicolasconnault>
Fri, 14 Aug 2009 05:45:56 +0000 (05:45 +0000)
committernicolasconnault <nicolasconnault>
Fri, 14 Aug 2009 05:45:56 +0000 (05:45 +0000)
lib/outputcomponents.php
lib/outputrenderers.php

index 07c515a1bb13ac4c87d820af3f71ba47fa8f19c9..e2178809aa5b69c557078784cdc8c9af54f050c4 100644 (file)
@@ -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;
index 05ec985ba86829e1b04718505913b1850240fad8..596167134c3d4b9dad89460124a71d3ddd6e4ef1 100644 (file)
@@ -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,