Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hi,
the add or edit links don't appear on node form below entity reference field for a custom entity (created with ECK module).
The search link is here, after creating a view.
I tried a dummy nodereference with article content type and it's working (add, edit ... links showing).
something is missing with my custom entity ?
thanks
Comments
Comment #1
zhgenti CreditAttribution: zhgenti commentedHi,
Try adding this hook
Comment #2
mich5 CreditAttribution: mich5 commentedhi,
thanks for the answer.
I tried this way:
(entity and bundle created with eck module, not code)
create an budget.module
adding code, but not sure about paths
I still have not the links (add then edit with ref added).
I will try another solution maybe.
Comment #3
AaronBauman"asset" is supposed to be the name of your entity type.
and "[bundle-sanitized]" and "[entity_id]" are literally supposed to go in as-is.
for example, here's the implementation for "bean" module:
http://drupal.org/files/references-dialog-bean-0.patch
See also:
#1836892: Compatibility with References Dialog
Comment #4
eliaspallanzani CreditAttribution: eliaspallanzani commentedwork for me after clearing cache.
for a newbye:
1. download eck module, unzip, find eck.module
2. patch with https://drupal.org/node/1836892 OR manually add to eck.module :
function eck_references_dialog_entity_admin_paths() {
$admin_paths = array();
$path = eck__entity_type__path();
foreach (EntityType::loadAll() as $entity_type) {
$admin_paths["{$entity_type->name}"] = array(
'add' => "{$path}/{$entity_type->name}/[bundle-sanitized]/add",
'edit' => "{$path}/{$entity_type->name}/[bundle-sanitized]/[entity_id]/edit"
);
}
return $admin_paths;
}
3. upload the edited file with ftp.
4. clear cache.
Comment #5
micnap CreditAttribution: micnap commentedI've got an entity type created by a contrib module (Redhen). I've added the hook_references_dialog_entity_admin_paths() hook to my custom module, cleared cache and am still not seeing the add link. I am seeing the Search link. Any ideas? What could possibly be missing?
Thanks,
Mickey
Comment #6
micnap CreditAttribution: micnap commentedNevermind. I'm a moron. I was using the entity type of the parent entity, not the entity I wanted to create. Works great. Thanks!
Mickey
Comment #7
profak CreditAttribution: profak commentedHello!
My problem is that i used hook_references_dialog_entity_admin_paths() to add support for my custom entity.
Well, it didn't work! I tried to use xdebug and set breakpoint into hook - so it never fires! I'm confused right now and have no idea what to do.
Thanks!
UPD: Maybe something wrong with my entity?!
Comment #8
AaronBaumandid you clear the site cache?
is this function in sitename_mods.module? if not, is the file this function is in getting loaded?
is sitename_mods module enabled?
also your implementation is still not quite right.
in your case "special offer" would be an entity, and you're implementing this hook in order to be able to create bundles for the entity.
so, it should be:
finally, judging from your implementation, maybe you don't actually need to create a custom entity?
Comment #9
profak CreditAttribution: profak commentedThank you for answer aaronbauman!
I tried eck to create entity and tried hook_mods_references_dialog_entity_admin_paths() aganist just created entity - everything works great.
That means, that i got everything about this hook and problem is in my code-implementation of my custom entity (special_offer).
So i have to find what's the matter with my entity.
Thanks a lot!
Comment #10
jaydub CreditAttribution: jaydub commentedSeems to me adding the hook as described above and noted in references_dialog.api.php file in the module gets the job done.
Comment #11
fakir22 CreditAttribution: fakir22 commentedzhgenti's solution (#1) worked perfectly for my custom entities written directly in code, not with ECK.
Thanks a lot
Comment #12
Yuri CreditAttribution: Yuri commentedThe latest ECK release has the code mentioned in #4 in eck.referenced_dialog.inc
However, for me sometimes this works, sometimes the links don't show up. I still have to see what causes them not to appear.
Comment #13
slimedidi CreditAttribution: slimedidi commented@Yuri
Do you find a way to work it out?
For me, it doesn't work.
If I login as Admin user role, it does work.
If I login as other user role with eck add permission, it doesn't work.
However, if I check "Add Entities" permission with other user role, it does work.....