From 051bf8c7f3f17a9ce0497ad563db42b82117eff0 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 29 Jul 2009 01:10:30 +0000 Subject: [PATCH] MDL-19756 Changed html_button->label to html_button->text --- lib/deprecatedlib.php | 6 +++--- lib/simpletest/testoutputlib.php | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 5ca3bbd46c..28a28e8be2 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -2618,7 +2618,7 @@ function print_single_button($link, $options, $label='OK', $method='get', $notus $form = new html_form(); $form->url = new moodle_url($link, $options); $form->button = new html_button(); - $form->button->label = $label; + $form->button->text = $label; $form->button->disabled = $disabled; $form->button->title = $tooltip; $form->method = $method; @@ -3020,12 +3020,12 @@ function notice_yesno($message, $linkyes, $linkno, $optionsyes=NULL, $optionsno= $formcontinue = new html_form(); $formcontinue->url = new moodle_url($linkyes, $optionsyes); - $formcontinue->button->label = get_string('yes'); + $formcontinue->button->text = get_string('yes'); $formcontinue->method = $methodyes; $formcancel = new html_form(); $formcancel->url = new moodle_url($linkno, $optionsno); - $formcancel->button->label = get_string('no'); + $formcancel->button->text = get_string('no'); $formcancel->method = $methodno; echo $OUTPUT->confirm($message, $formcontinue, $formcancel); diff --git a/lib/simpletest/testoutputlib.php b/lib/simpletest/testoutputlib.php index ab927fe7e6..e8ffc1286d 100644 --- a/lib/simpletest/testoutputlib.php +++ b/lib/simpletest/testoutputlib.php @@ -948,7 +948,7 @@ class moodle_core_renderer_test extends UnitTestCase { public function test_button() { global $CFG; $originalform = new html_form(); - $originalform->button->label = 'Click Here'; + $originalform->button->text = 'Click Here'; $originalform->url = '/index.php'; $form = clone($originalform); @@ -1011,9 +1011,9 @@ class moodle_core_renderer_test extends UnitTestCase { $this->expectException(); $html = $this->renderer->link($link->url->out()); } - + /** - * NOTE: consider the degree of detail in which we test HTML output, because + * NOTE: consider the degree of detail in which we test HTML output, because * the unit tests may be run under a different theme, with different HTML * renderers. Maybe we should limit unit tests to standardwhite. */ @@ -1035,7 +1035,7 @@ class moodle_core_renderer_test extends UnitTestCase { $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'cancel', 'value' => 1)), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('no'), 'class' => 'singlebutton')), $html); - + // Use html_forms with default values, should produce exactly the same output as above $formcontinue = new html_form(); $formcancel = new html_form(); @@ -1053,23 +1053,23 @@ class moodle_core_renderer_test extends UnitTestCase { $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'cancel', 'value' => 1)), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('no'), 'class' => 'singlebutton')), $html); - + // Give the buttons some different labels $formcontinue = new html_form(); $formcancel = new html_form(); $formcontinue->url = new moodle_url($continueurl); $formcancel->url = new moodle_url($cancelurl); - $formcontinue->button->label = 'Continue anyway'; - $formcancel->button->label = 'Wow OK, I get it, backing out!'; + $formcontinue->button->text = 'Continue anyway'; + $formcancel->button->text = 'Wow OK, I get it, backing out!'; $html = $this->renderer->confirm($message, $formcontinue, $formcancel); $this->assert(new ContainsTagWithAttributes('form', array('method' => 'post', 'action' => 'http://www.test.com/index.php')), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'continue', 'value' => 1)), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html); - $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => $formcontinue->button->label, 'class' => 'singlebutton')), $html); + $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => $formcontinue->button->text, 'class' => 'singlebutton')), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'cancel', 'value' => 1)), $html); $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html); - $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => $formcancel->button->label, 'class' => 'singlebutton')), $html); - + $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => $formcancel->button->text, 'class' => 'singlebutton')), $html); + // Change the method and add extra variables $formcontinue = new html_form(); $formcancel = new html_form(); -- 2.39.5