Active
Project:
Views Hybrid
Version:
7.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2014 at 11:03 UTC
Updated:
5 Sep 2014 at 15:39 UTC
Jump to comment: Most recent
@bbinkovitz
In https://www.drupal.org/node/2301499 you say you like the recursion check.
I improved the check by using less resources:
The code in above node starts with:
if (empty($recursive)) {
$wrapper = entity_metadata_wrapper($entity_type, $entity);
$recursive[] = array(
'type' => $entity_type,
'id' => $wrapper->getIdentifier(),
);
unset ($wrapper);
}
It now reads:
if (empty($recursive)) {
$ids = entity_extract_ids($entity_type, $entity);
$recursive[] = array(
'type' => $entity_type,
'id' => $ids[0],
);
}
Off course I don't know your implementation, so it's up to you how to implement the recursive check.
Comments
Comment #1
bbinkovitz commentedThanks! Actually I have committed a modified version of this concept, with credit to your username, to the 8.x-1.x branch of this module already. 8.x has a couple of issues, such as entityreference doesn't give a target_type, so I am still trying to figure out a workaround for that (currently hardcoded to "node" for testing). Also there is no entity_metadata_wrapper() in 8. But the relevant code is:
Then inside the foreach: