How does create link work?

jackd

Joined: 2006-02-04
Posts: 1
Posted: Sat, 2006-02-04 20:51

I guess this is a dumb question, but I'll ask anyway. I'm not sure how "create link" works. How do you get rid of a create link 'album?' Does delete photo in that context delete the actual photo or reference. I couldn't find much reference to this feature.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-02-04 22:15

you can not create a link album with the "create link" option. you can only create link items (photos, ..).
with the linkalbum module, you can create links of albums too in add item -> linkitem -> from album.

if you delete a link item, only the link (reference) is deleted.
if you delete the original, the link (reference) becomes the new original. it keeps track of references etc. nothing bad can happen.

 
oko

Joined: 2006-01-30
Posts: 5
Posted: Fri, 2006-03-17 01:46
valiant wrote:
if you delete the original, the link (reference) becomes the new original. it keeps track of references etc. nothing bad can happen.

assuming that the original item had been linked in multiple albums, does this mean that one of the links (references) will no longer be a reference and become an orginal ? If so, is it possible to determine which one of the links will be the new orginal ?

 
oko

Joined: 2006-01-30
Posts: 5
Posted: Fri, 2006-03-17 16:18

i got a chance to dig into the code (2.0.x) and it would seem that we get an array of all the linked itemIds and then make the frist entry of the array the new original. So it would seem the new original entity will be the frist element of the array returned by GalleryEntityHelper_medium::fetchEntitiesLinkedTo($itemId) [i did not venture deeper in the code then this]

 
Yuan

Joined: 2003-12-03
Posts: 144
Posted: Fri, 2006-03-17 22:00

This is the same concept as hard links in a Unix file system: the physical file and links are managed seperately. Only when link count becomes zero will a physical file deleted.

 
oko

Joined: 2006-01-30
Posts: 5
Posted: Sun, 2006-03-19 18:36

ahh , i see , that does make more sense when your draw that analogy.
I was curious because i am working on a lightbox / favorites module that is based off the "create link" core functionality [core.ItemCreateLink].