Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#4 | 1337694-4-new-formatter.patch | 6.2 KB | JohnAlbin |
#2 | 1337694-2-new-default-formatter.patch | 6.2 KB | JohnAlbin |
#1 | 1337694-1-new-default-formatter.patch | 5.07 KB | JohnAlbin |
Comments
Comment #1
JohnAlbinHere's the patch.
Comment #2
JohnAlbinThe 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.
Comment #3
tim.plunkettI don't know that this is reasonable.
Otherwise, the code looks great. I'll give it a real test tomorrow.
Comment #4
JohnAlbinI'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.
Comment #5
tim.plunkettWorks as advertised. I'm a big fan of less arbitrary markup.
http://drupalcode.org/project/field_collection.git/commit/3c10073