The default attributes from the field settings are not transferred. There are only empty strings in the item attributes. For example, the settings for the "rel" attributes are not taken into account in the display.

CommentFileSizeAuthor
link.module.patch488 byteshkramer

Comments

jcfiala’s picture

Status: Active » Postponed (maintainer needs more info)

Can you be more specific about what this change helps/does? If you can write up a simpletest that shows the problem, that would really help.

Ie, "I create a field, and set x and y on it, and then when I create a node with this data, then it doesn't do Z".

mkalkbrenner’s picture

Version: 6.x-2.8 » 6.x-2.x-dev
Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

We're using this patch since more than a year and are happy with it.

Explaination for jcfiala:

   // Merge item attributes with attributes defined at the field level.
+  $item['attributes'] = array_filter($item['attributes']);
   $item['attributes'] += $field['attributes'];

The operator "+=" only adds array values if their key is not already present in the first array.
If the $item['attributes']['rel'] exists but is emtpy it won't be overridden by $field['attributes']['rel']. array_filter($item['attributes']) removes all empty values from $item['attributes'] first. Now the default values from $field['attributes'] will be applied.

jcfiala’s picture

Status: Reviewed & tested by the community » Fixed

Applied to dev branch.

Status: Fixed » Closed (fixed)

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