I am trying to use Term access module
where I want match user terms used in field collection items with terms used in node,
I am able to other tweaking, except the user terms extraction from field collection items
here is the code from that module I have changed to 'field collection item' from 'user'
<?php
$user_fields = field_get_items('field_collection_item', $account, $field_name);
if (!empty($user_fields)) {
foreach ($user_fields as $term) {
$user_terms[$field_name][$term['tid']] = TRUE;
?>
admin.inc code is:
<?php
->condition('fi.entity_type', 'node')
->condition('fi.bundle', $type)
->condition('f.type', $term_access_field)
->condition('fi2.entity_type', 'field_collection_item')
->fields('f', array('field_name'))
->execute();
?>
again i changed to 'field collection item from' from 'user'
after changing this I get Entity malformed exception, obviously because ID are not extracted.
can some one put some help here, I am not coder
Also some term reference field are multi value fields
I wanted all the terms associated with the field if it is multi value field
Help is highly appreciated
Comments
Comment #1
kaizerking CreditAttribution: kaizerking commentedNow i changed the
in to
at least some progress with Warning: Invalid argument supplied for foreach() in DrupalDefaultEntityController->buildQuery() (line 290 of E:\xampp\htdocs\newfolder\includes\entity.inc).
if some one can help me on how to extract 'tid's attached to the filed collection items.
Comment #2
jmuzz CreditAttribution: jmuzz commentedYou may have more luck using field_collection_item_load. You only have to pass it the field collection item id, ei. the 'value' for the field collection item in its host.