Adding options to the ImageBlock module.
gaynormcc
Joined: 2003-09-05
Posts: 426 |
Posted: Thu, 2006-02-09 02:29 |
As I had asked in http://gallery.menalto.com/node/44027:- ckdake suggested using the image block module and :- So I am transferring this to Module forum. (A) One of the things I want to do is designate a specific image (as an image block) The Link or text would be its title/caption brought with it. Presumably I need to add Adaptations of the line eg 'specificImage' => $gallery->i18n('Specific Image'), # But how and where do I define the "Specific image" and Valiant seems to answer this in his reply to someone else in “you'll have to modify the imageblock module, maybe Could you please give me an example of the line required ? Gaynor (Learning heaps with your help) |
|
Posts: 426
Heavens, I am thinking on my feet here.
What I really want is even more than above.
I'd like the sidebar to have three imageblocks in it each one giving random images from a different specified album
So the line adaptation would be
'Album_01RandomImage ' => $gallery->i18n('Album_01 Random image'),
Presumably this would generate a dropdown album tree in the Edit Album/Theme Imageblock selection.
and the Specific Image line generate a corresponding dropdown or a link to an index page similar to what Nick (gamecat) is working on in http://gallery.menalto.com/node/44193
Golly this does get complicated doesn't it.
But Site admin/imageblock does already have "SpecificItem" mentioned and referred to as available for external blocks. So presumably code for it is somewhere.
Gaynor
Posts: 2258
Here's what you would need to do:
-Get imageblock working returning a specifc album, item, or album and its subalbums, etc
-Add a setting to your new custom theme settings page that allows you to set some number of image blocks
-Add a setting that can be repeated over and over that has a few fields:
-type (random from album, random from album+subalbums, specific, etc)
-itemID (album's id for album options above, item's id for items)
-Modify the theme to check for those settings and call the modified imageblock as needed
Posts: 426
This looks as if it could work Chris, but I can;t work out how to do these steps.
The English is understandable in English.
At present I am having difficulty translating your instructions (in English) into computer language.
Gaynor
Posts: 426
So do you mean:-
In {$block.item.description}
item = ‘randomImageFromAlbum_01 (ID of album01)’
and description = 'Random Image from Album_01'
So I have to adapt {$block.item.description} to
{$block.’randomImageFromAlbum_01 (ID of Album01)’.’Random Image from Album_01’} etc
and adapt
'randomImage' => $gallery->i18n('Random image'), to
‘randomImageFromAlbum_01 (ID of album01)' => $gallery->i18n('Random image from album_01'),
etc
I need to copy the module “imageblock” to a newly created folder called “local” then in gallery2/modules/local/imageblock/templates/blocks/blocks.inc
include
{$block.’specificItem (id for specific Item)’.’Specific Item’},
{$block.’randomImageFromAlbum_01 (ID of album_01)’.’Random Image from Album_01’},
{$block.’randomImage from album_02 (ID of album_02)’.’Random Image from album_02’}
and in the relevant position, add
{‘specificItem (id for specificItem)' => $gallery->i18n(‘Specific Item’),
‘randomImageFromAlbum_01 (ID of album01)' => $gallery->i18n('Random image from album_01'),
‘randomImageFromAlbum_02 (ID of album02)' => $gallery->i18n('Random image from album_02'),
}
Which should then add to the dropdown list in ‘block/ImageBlock’ on the ‘Edit Album/theme’ page
“ ‘Specific Item’, 'Random image from album_01’, and 'Random image from album_02' “
Am I correct?
Gaynor
Posts: 2258
Nope. That wouldn't be very flexibile because you would have to modify the code for each album. I'd say you want to add something along the line of:
gallery2/modules/imageblock/classes/ImageBlockHelper.class: ~66
'specificAlbum' => $gallery->il8n('Specific Album'),
'specificItem' => $gallery->il8n('Specific Item')
Then take a look at _getBlockData in that file and add a case for those to and figure out what needs to be done there.
Then, add stuff into gallery2/modules/imageblock/ImageBlockOption.inc to allow an admin to set wether or not to show a specific item as a block, and if so what kind and what id to use.
For now, just try and get a subset of functionality working and you can expand from there (an option in ImageBlockOption for an id, if its blank don't use it, if its not blank, show that id's thumbnail at the bottom of the page)