Commit e088b8f0 authored by alexpott's avatar alexpott

Issue #2160365 by plopesc, vijaycs85: Date field required marker rendered as "Array".

parent 750a1d84
......@@ -227,13 +227,11 @@ function template_preprocess_datetime_wrapper(&$variables) {
$element = $variables['element'];
// If the element is required, a required marker is appended to the label.
$variables['required'] = NULL;
if(!empty($element['#required'])) {
$variables['required'] = array(
'#theme' => 'form_required_marker',
'#element' => $element,
);
}
$form_required_marker = array(
'#theme' => 'form_required_marker',
'#element' => $element,
);
$variables['required'] = !empty($element['#required']) ? drupal_render($form_required_marker) : '';
if (!empty($element['#title'])) {
$variables['title'] = $element['#title'];
......
......@@ -69,6 +69,7 @@ function setUp() {
'field_name' => $this->field->name,
'entity_type' => 'entity_test',
'bundle' => 'entity_test',
'required' => TRUE,
));
$this->instance->save();
......@@ -97,6 +98,7 @@ function testDateField() {
// Display creation form.
$this->drupalGet('entity_test/add');
$this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.');
$this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]/h4/span', '*', 'Required markup found');
$this->assertNoFieldByName("{$field_name}[0][value][time]", '', 'Time element not found.');
// Submit a valid date and ensure it is accepted.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment