Field Collection provides a way to reuse sets of fields by defining an entity whose purpose is to have fields attached to it. Field Collection is very widely used in Drupal 7 builds. An alpha version of 8.x-1.0 exists and is working on Drupal 8.1.

Project URL

Where's the code?


8.x-3.x is in development


The Drupal 7 version of Field Collection depended on Entity API. All of Entity API's functionality is in Drupal 8 core, so the straight Drupal 8.x-1.x port has no additional dependencies (assuming its architecture isn't changing much).

Who's doing the port?

jmuzz for 8.x-3.x

fago, larowlan, jmuzz and tim.plunkett are the main committers to 8.x-1.x. You can get some idea of when and how much each were involved up to October 2015 in the commit list on #1443960: Field Collection for Drupal 8 .

Currently tedbow is leading the work on 8.x-2.x, but is looking for help. No longer part of this project

What help do they need?

Anyone familiar with Inline Entity Form, Field Widgets, and Field Formatters.

D8 Roadmap


Background/Reference Info

#1443960: Field Collection for Drupal 8


phenaproxima created an issue. See original summary.

phenaproxima’s picture

Status: Active » Needs review
webchick’s picture

As of right now, both the 8.x dev release and the sandbox appear to be in sync. Filed #2603054: Close this sandbox and move development to Field Collection queue? to see about consolidating.

PratikshaD’s picture

Not able to add value for field in field Collection Drupal 8

I have done custom code to add value for field but its throwing error which is given below.

Code is given below-
$mynode = node_load(983);
$field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_test'));
$field_collection_item->field_end_date[LANGUAGE_NONE][0]['value'] = "20-20-2015";
$field_collection_item->field_account_name[LANGUAGE_NONE][0]['value'] = "DCX";

// Save field collection item

I got this Error-

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Unable to get a value with a non-numeric delta in a list. in Drupal\Core\TypedData\Plugin\DataType\ItemList->get() (line 103 of core\lib\Drupal\Core\TypedData\Plugin\DataType\ItemList.php).

csvimport_import_batch_processing(Array, Array)
call_user_func_array('csvimport_import_batch_processing', Array)
call_user_func_array(Array, Array)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
call_user_func_array(Object, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)

webchick’s picture

Hey there! A much better place for this bug report would be over in the field collection issue queue. This issue's simply tracking its current D8 porting status.

PratikshaD’s picture

This is not very much clear to me could you please elaborate.
While creating new entity for field Collection in D8, I am getting error for langcode its should be in numeric format:
"InvalidArgumentException: Unable to get a value with a non-numeric delta in a list. in Drupal\Core\TypedData\Plugin\DataType\ItemList->get() (line 103 of core\lib\Drupal\Core\TypedData\Plugin\DataType\ItemList.php)."

Below is the code snippet :
$mynode = node_load(983);
$field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_test'));
$field_collection_item->field_end_date[LANGUAGE_NONE][0]['value'] = "20-20-2015";
$field_collection_item->field_account_name[LANGUAGE_NONE][0]['value'] = "DCX";

// Save field collection item

Please suggest...

webchick’s picture

Yes, please search for your issue. If it's not found, report it over there with the "Create new issue" link.

penyaskito’s picture

Issue summary: View changes
penyaskito’s picture

Latest commit on 8.x-1.x branch in the project itself is more recent than the sandbox, so editing summary.

tim.plunkett’s picture

Issue summary: View changes

After several days of discussion, we've decided to rewrite the module on top of Inline Entity Form. This will become the 8.x-2.x branch.
The 8.x-1.x branch is still open for patches, as it intends to mirror the architecture of the D7 version.

I'm happy to commit patches to both versions while they are under development.

tim.plunkett’s picture

Status: Needs review » Needs work
jibran’s picture

Is there an issue for that which we can follow? Are we going to use ER field for field_collection_item? See #2509254: Field collection fields should extend entity reference fields for more details.

larowlan’s picture

+1 to 10 and 12

Sam152’s picture

Paragraphs might be worth looking at. I believe that was built on top of entity_reference_revisions for the field type/widget. Might help consolidate efforts and save time.

colepacak’s picture

I know the ETA is still unknown but do you guys have a ballpark?

My team is working on a D8 site that would ideally use Field Collection but I'm trying to figure out whether to move forward without it.

heddn’s picture

@colepacak, there is also paragraphs and custom entities that would work. the drupal console just had land everything you need for a custom bundle-able entity.

tim.plunkett’s picture

Issue summary: View changes
jmuzz’s picture

There's an alpha for field collection 8.x-1.x now that I'd say is pretty solid. I've been working on it on and off for the last couple of years. I've also been maintaining the drupal 7 version of the module during that time.

I never saw the discussion about starting over to make a rewrite. I don't think there was an issue about it.

Given that it's not really a new version of the module but a total rewrite, it would make more sense to classify it as a competitor to field collections like complex fields or multifield, both of which were talked about in the fieldable fields in core issue.

People seem to have a love/hate relationship with field collections. Everybody uses it but everybody wishes there was something better. I am all for new ideas but for the sake of fairness they should be on an even playfield, and given the amount of work that has already gone into field collection 8.x-1.x and where it is compared to the other versions it would be a waste to try to convince people that it's obsolete.

I think 8.x-2.x should be moved out to a separate project. If it ends up more useful then field collection people will switch to it. I don't know who all was involved in the days of discussions @tim.plunkett mentions, but if they really do want to start over from scratch they should aim to make something that can stand on its own like the developers of multifield and complex field are trying to do.

jmuzz’s picture

Issue summary: View changes
jmuzz’s picture

Status: Needs work » Needs review
asibona’s picture

I'm trying to porting field_permission module to drupal 8.
(Road Map ->
I realized this feature is lacking [getOwnerId()], do I have to do a special check to field_collection or can you implement this

* Get entity Author id.
public function getOwnerId() {
return $this->getHost()->getOwnerId();

in FieldCollectionItem.php


jmuzz’s picture

Hi @asibona.

I made a separate issue for your request.

#2734551: Field permission support for Drupal 8

mmjvb’s picture

Issue summary: View changes
Status: Needs review » Needs work

According to maintainer work is on 8.x-3.x which has an development version. Set Status to `Needs work` for that.
Assuming there is no future for 8.x-1.x.

Not clear what info pertains to 8.x-3.x or 8.x-2.x. My understanding is 8.x-2.x is no longer part of this project.
Please correct anything that is wrong or not applicable anymore.

webchick’s picture

I'm wondering if we should mark this one "Closed (duplicate)" in favour of Paragraphs module... that seems to be the answer I routinely get when I ask people what they're using instead of Field Collection in D8.

heddn’s picture

The only thing that holds me back from doing that is we need to create a migrate source deriver in paragraphs for field collections. I keep thinking we need to open an issue but haven't gotten around to it. Once the issue is open, I'm in favor of duplicate.

webchick’s picture

heddn’s picture

Status: Needs work » Closed (duplicate)

Looks good enough to me.

StevenNord’s picture

Since everyone is talking about Paragraphs maybe replacing Field Collections in D8.... I just recorded a screencast showing the team of developer I work with at our news company how to create a collection of fields for displaying news story photos with a field for attributed the source who provided the photo. It was super easy and even though it was a dry run and my first time using Paragraphs for this.

Would anyone be interested in watching it? If so, I'll just need to go through and make sure no proprietary info is in the video and will probably just record a new one for everyone if enough people would like me to.

StevenNord’s picture

I've made over 60 detailed videos on different topics of developing in Drupal 8 so far over the last 2 weeks and will keep it going. They are for my team though so I will most likely have to re-record many of them. If you want me to make you one on field collections or anything just let me know. I have over 15 years experience with Drupal and its fun to me to make these videos.

PS: I'm expanding/replying to my own post #28.

The community has helped me so much over the last 15 years. I'm paying it forward now and giving back. :)

Catch ya on the flip in a next video.