summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcatch2012-03-22 08:08:05 (GMT)
committercatch2012-03-22 08:08:05 (GMT)
commitc804c2bc6737f406eafd3ead3551ac32c402b7f7 (patch)
tree82583add0aa978378d3350912600c9385da45095
parent92373806e4d91bd7743fc34056f6c916af7ac8a8 (diff)
Issue #1475666 by filijonka, Devin Carlson, Kevin Morse, tstoeckler, Niklas Fiekas: Fixed PHP error because of typo in form.inc line 3025.
-rw-r--r--core/includes/form.inc2
-rw-r--r--core/modules/simpletest/tests/form.test5
-rw-r--r--core/modules/simpletest/tests/form_test.module9
3 files changed, 15 insertions, 1 deletions
diff --git a/core/includes/form.inc b/core/includes/form.inc
index c1d48e3..c3571f4 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -3094,7 +3094,7 @@ function form_pre_render_conditional_form_element($element) {
$element['#attributes']['title'] = $element['#title'];
if (!empty($element['#required'])) {
// Append an indication that this field is required.
- $element['#attributes']['title'] .= ' (' . $t('Required') . ')';
+ $element['#attributes']['title'] .= ' (' . t('Required') . ')';
}
}
diff --git a/core/modules/simpletest/tests/form.test b/core/modules/simpletest/tests/form.test
index 3946374..582b473 100644
--- a/core/modules/simpletest/tests/form.test
+++ b/core/modules/simpletest/tests/form.test
@@ -740,6 +740,11 @@ class FormsElementsLabelsTestCase extends DrupalWebTestCase {
$elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]');
$this->assertTrue(isset($elements[0]), t("Properly places the #suffix element before the form item."));
+
+ // Check that required checkboxes with #title_display attribute have
+ // a description but no title is displayed.
+ $this->assertFieldByXPath('//div[contains(@class, "form-item-form-checkboxes-test-title-display-attribute")]/div[contains(@class, "description")]', NULL, 'Description displayed for #title_display attribute.');
+ $this->assertNoFieldByXPath('//label[@for="edit-form-checkboxes-test-title-display-attribute"]', NULL, 'No title displayed for #title_display attribute.');
}
}
diff --git a/core/modules/simpletest/tests/form_test.module b/core/modules/simpletest/tests/form_test.module
index 4b0f295..ef553e4 100644
--- a/core/modules/simpletest/tests/form_test.module
+++ b/core/modules/simpletest/tests/form_test.module
@@ -821,6 +821,15 @@ function form_label_test_form() {
$form['form_textfield_test_title_no_show'] = array(
'#type' => 'textfield',
);
+ // Test required checkboxes with #title_display attribute and a description.
+ $form['form_checkboxes_test_title_display_attribute'] = array(
+ '#type' => 'checkboxes',
+ '#title' => 'Checkboxes, #title_display attribute',
+ '#title_display' => 'attribute',
+ '#required' => TRUE,
+ '#description' => 'Required checkboxes with #title_display attribute and a description.',
+ '#options' => drupal_map_assoc(array('foo', 'bar', 'baz')),
+ );
return $form;
}