Twig field collection theme get field id I am trying to get the field ID of of a field collection item being rendered in a field collection theme twig file: field-collection-item--field-name.html.twig.

I am able to render content using  {{content.field_name}} but I need a unique identifier to create an anchor link.
I can see an id is available using kint(item) but cant seem to figure out the proper syntax.

Any help would be greatly appreciated...
You can get The field collection item ID in field-collection-item.html.twig

{{ item['#field_collection_item'].id() }}


or you can get it from field-collection-item--field-name.html.twig, or other field template of field collection item.

{{ element['#items'].getEntity().id() }}


You can find these functions under Available Methods Tab when you printing out variables from twig template. You can use public methods.