Create Field Collection Programmatically attached to Taxonomy Term

Public

Create Field Collection Programmatically attached to Taxonomy Term

</> CopyGet raw version
php
  1. $field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_awards'));
  2. $field_collection_item->setHostEntity('taxonomy_term', $term);
  3. $field_collection_item->field_year['und'][] = array('value' => '1998-01-01 00:00:00');
  4. $field_collection_item->field_display_name['und'][] = array('value' => 'rock out');
  5. $field_collection_item->save();

Comments