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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

franz’s picture

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.

Dries’s picture

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

aspilicious’s picture

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.

sun’s picture

Issue tags: +Needs backport to D7

Nice catch. Looks safe to be backported to me.

Liam Morland’s picture

D7 version of the patch attached.

Dries’s picture

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.

Liam Morland’s picture

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

franz’s picture

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.

Dries’s picture

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.