theme_field_multiple_value_form() in field.form.inc duplicates the code to generate a form required marker, rather than using the theme system. This patch replaces the duplicate code with a theme system call.

Files: 
CommentFileSizeAuthor
#5 theme_form_required_marker_field_form_inc-D7.patch753 bytesLiam Morland
theme_form_required_marker_field_form_inc.patch753 bytesLiam Morland
PASSED: [[SimpleTest]]: [MySQL] 33,528 pass(es).
[ View ]

Comments

Status:Needs review» Reviewed & tested by the community

This seems very adequate. Not only it was duplicating, but also making it impossible to theme it.

This looks good to me; let's see if there is more feedback though.

I found the implementation of the theme function

function theme_form_required_marker($variables) {
  // This is also used in the installer, pre-database setup.
  $t = get_t();
  $attributes = array(
    'class' => 'form-required',
    'title' => $t('This field is required.'),
  );
  return '<abbr' . drupal_attributes($attributes) . '>*</abbr>';
}

It's an exact copy so this is good to go.

Issue tags:+needs backport to D7

Nice catch. Looks safe to be backported to me.

D7 version of the patch attached.

This patch does not seem to apply against 8.x:

deimos:drupal-head dries$ curl http://drupal.org/files/issues/theme_form_required_marker_field_form_inc-D7.patch > ../f.p
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
107   753  107   753    0     0   4075      0 --:--:-- --:--:-- --:--:--  8096
deimos:drupal-head dries$ git apply ../f.p
error: patch failed: modules/field/field.form.inc:273
error: modules/field/field.form.inc: patch does not apply

Let's see what the test bot says in #5.

The patch in #5 is for Drupal 7. The patch in the original post is for Drupal 8.

patch in #5 has '-D7' suffix, so it will be ignored by testbot. It's better re-submit it after successful commit of patch in the original bug.

Status:Reviewed & tested by the community» Fixed

D'oh. Not sure how I overlooked the -D7 suffix.

I committed #5 to 7.x and the original patch to 8.x.

We should be all set now. Thanks for your help!

Automatically closed -- issue fixed for 2 weeks with no activity.