Override EB3 layouts

[Omeka 2.1.4] I'm attempting to override the 'gallery' layout in Exhibit Builder 3.0. The reason I'd like to override it is that if the user uninstalls my plugin, I'd like it to fall back to gallery and not to 'file-text'. I'm able to create a whole new layout, but is there any way to override the ones that come with Exhibit Builder?

The specific things I'm trying to do (if it helps) are add the ability to center the gallery images and change the thumbnails from square to proportional.

When I call Zend_View_Interface#getAllPaths() -- I don't know which class it is -- I get this list (simplified):

[script] => Array
  (
    [0] => /var/www/admin/themes/default/exhibit-builder/
    [1] => /var/www/plugins/ExhibitBuilder/views/admin/
    [2] => /var/www/plugins/ExhibitBuilder/views/shared/
    [3] => /var/www/plugins/MyGalleryLayout/views/shared/
    [4] => /var/www/plugins/SimplePages/views/admin/
    [5] => /var/www/admin/themes/default/
    [6] => /var/www/application/views/scripts/
  )

If I could make MyGalleryLayout load before ExhibitBuilder, would that give my gallery layout precedence over EB core?

You should be able to center the gallery images using CSS and the text-align. Property.

In terms of changing the thumbnail type, the best way to do that is with a plug-in.

Using the gallery layout as a template, changing

$this->exhibitAttachmentGallery($attachments)

to

$this->exhibitAttachmentGallery($attachments, array('imageSize' => 'fullsize'))

and controlling the actual size via CSS might work, otherwise you will have to write a custom function.

See here for more details on creating a custom layouts plugin: http://omeka.org/forums/topic/custom-layouts-for-exhibit-builder-30

Thanks for the answer!

While I'm interested in centering the images, I'm more interested in giving my colleagues the ability to choose for themselves regardless of which theme is enabled. So I like the idea of including that in layout settings.

I actually had found that line in the gallery layout and overridden it in my plugin. I stored the user's thumbnail shape choice with this in form.php (abbreviated):

echo $this->formSelect($formStem . '[options][gallery-extended-thumbnail-shape]',
            @$options['gallery-extended-thumbnail-shape'], array(),
            array(
                'square_thumbnail' => __('Square'),
                'thumbnail' => __('Proportional')
            )
        );

And then displayed it with this (abbreviated):

$this->exhibitAttachmentGallery($attachments, array('imageSize' => $thumbnailShape));

I think I'll continue with my original plan of creating a whole new layout for these two features; it won't roll back to gallery if my plugin is uninstalled, but it's not that hard to rebuild a block manually. Of course, a bunch of them might be difficult. :-)

Thanks again!

If you're committed to providing that kind of rollback, you could write an update query to do it in your plugin's uninstall hook, finding all the rows in the blocks table that are using your new layout and switching them to 'gallery'.

Thanks, John... good point. I suppose deactivating the plugin would still be a problem, though...