Hi All,
I want to add systemLinks with "add photos!". it linked to create new album (core.ItemAddAlbum)
my problem is :
how to get value of '$theme.item.id' in 'gallery2/modules/core/module.inc'
here my code:
if ($isAnonymous) {
$links['Login'] = array('text' => $this->translate('Login'),
'params' => array('view' => 'core.UserAdmin',
'subView' => 'core.UserLogin',
'return' => 1));
} else {
$user = $gallery->getActiveUser();
$links['core.addAlbumItem'] = array('text' => $this->_translate('Add Photos !'),
'params' => array('view' => 'core.ItemAdmin',
'subView' => 'core.ItemAddAlbum',
'itemId' => $theme.item.id, /* here the problem, i cant get the value*/
'return' => 1));
$links['Logout'] = array('text' => $this->translate('Logout'),
'params' => array('controller' => 'core.Logout',
'return' => 1));
}
Thanks,
Nanang
Posts: 4342
It's a nonsense to have an "add photo" systemLink.
SystemLinks are for system-wide options, and don't specify *where* the new item should be added. Which is exactly why you're having trouble finding the correct variable, the context doesn't exist at the time the systemLinks are rendered. For example, systemLinks show up also in admin pages; if you were to try to add a new album while viewing an admin page, where would you expect the album to be added? It doesn't make sense.
Posts: 3
Thank you for your post.. but i think i made a wrong statement/question
i already added a link in the upper menu, the SystemLinks. the link called "add photo!". so the SystemLinks will be look like this (after you login) "Site Admin, Your Album, Add Photos !, logout". if you click this link, it will transfer you to a page to create a new album. but then the value not always exist in this variable ($theme.item.id)
Maybe you can show me where should i put the correct code to get this variable's value from $theme.item.id?
if you think this is non-sense, can you direct me or give me some enlightment?
i made some changes in 'gallery2/modules/core/module.inc'
thanks
Posts: 4342
I can only repeat what I said before.
When you click a link called "add photo", Gallery needs to know where to add the photo. Think of "Add Photo" as being short for "Add Photo in *this* album." But systemLinks show up on pages which aren't albums, they're systemLinks, they're to do with the system, not particular albums. It just doesn't mean anything to say Add Photo without the link being *in* the album in which you want to add the photo. That's why Add Photo is and *must* be an itemAction, not a systemLink.