In node edit form with Tree view widget, its return value is using entity_id. But in organic group module, it is expecting a gid rather than entity_id.
Attached the patch for it. please review.

Thanks,

Comments

william.lai’s picture

Issue summary: View changes

update description

Pierco’s picture

Works for me !
But you forgot to remove the dsm() function in your patch.

Edited: Doesn't work on other entities. Maybe you should test if $entity->gid is set before using it:

$id = isset($entity->gid) ? $entity->gid : $entity->id;

then...

'#on_value' => $id,
...
lahode’s picture

Hi, there

I just sent a new version that should correct this issue. Your suggestion william.lai is good but does only work for oggroups.
This project aims to work on any sort of entities, that's why I added a target_id and target_name that your can customize for the entity you want. For instant, og_group will have gid as target_id and taxonomy would have tid as target_id

Let me know if you still have an issue

Cheers

johaziel’s picture

StatusFileSize
new55.69 KB

Hi lahode,

that doesn't work for taxonomy, I don't have any value in the <input /> and the vocabulary is not loaded completly

I check the $entity in _entity_reference_tree_build_item() with dpm.
and it seems that not tid the #target_id but id (look the .png)

I changed in entity_reference_tree.module line 643

$element['#target_id'] = 'tid';

to

$element['#target_id'] = 'id';

and now it work for me...

lahode’s picture

Status: Needs review » Fixed

Hi, I made some changes and tested it. Everything seems to work, please try again with the new version

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

update description