The current default formatter has way too much markup when it is rendered. Each field in the collection already has its own theme_field wrapping. And the collection field also has that same theme_field wrapping. Why do we need to add 2 more layers of markup around the collection? The only purpose I see for the markup is the add/edit/delete links, but many people don't want those links anyway. See #1322624: Remove Add/Edit/Delete link functionality at all

How about a formatter that just renders the fields in the collection and does no more? And let's make it the default, okay?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JohnAlbin’s picture

Status: Active » Needs review
FileSize
5.07 KB

Here's the patch.

JohnAlbin’s picture

The patch in #1 is fine, but it becomes a lot more interesting if you add this other issue first: #1324328: Field collection view mode formatter

Here's the patch in #1 re-rolled assuming that the patch in #1324328 is committed first.

tim.plunkett’s picture

Status: Needs review » Needs work
+++ b/field_collection.moduleundefined
@@ -539,7 +539,7 @@ function field_collection_field_info() {
-      'default_formatter' => 'field_collection_view',
+      'default_formatter' => 'field_collection_fields',

I don't know that this is reasonable.

Otherwise, the code looks great. I'll give it a real test tomorrow.

JohnAlbin’s picture

Title: Add new default formatter that doesn't add any HTML wrappers around field collection items » Add formatter that doesn't add any HTML wrappers around field collection items
Status: Needs work » Needs review
FileSize
6.2 KB

I don't know that this is reasonable.

I'll save the "my formatter is better than your formatter" debate for another issue. :-)

I noticed the formatter was missing a settings array. So I added that and removed the change in the default formatter. Updated patch attached.

tim.plunkett’s picture

Status: Needs review » Fixed

Works as advertised. I'm a big fan of less arbitrary markup.
http://drupalcode.org/project/field_collection.git/commit/3c10073

Status: Fixed » Closed (fixed)

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