Omeka Classic Logo
  • What’s new in Omeka
  • Tutorials
  • Reference
    • Global (Theming) Functions
    • Hooks
    • Filters
      • All Filters
        • <model>s_browse_default_sort
        • <model>s_browse_params
        • <model>s_browse_per_page
        • <model>s_select_options
        • ElementSetForm Filter
        • Element Display Filter
        • Element ElementForm Filter
        • Element ElementInput Filter
        • Element Flatten Filter
        • Element Save Filter
        • Element Validation Filter
        • action_contexts
        • admin_collections_form_tabs
        • admin_dashboard_panels
        • admin_dashboard_stats
        • admin_files_form_tabs
        • admin_items_form_tabs
        • admin_navigation_appearance
        • admin_navigation_global
        • admin_navigation_main
        • admin_navigation_settings
        • admin_navigation_users
        • admin_theme_name
        • admin_whitelist
        • all_element_texts_options
        • api_extend_<resource>
        • api_resources
        • batch_edit_error
        • body_tag_attributes
        • browse_plugins
        • browse_themes
        • display_elements
        • display_option_*
        • display_records_types
        • file_ingest_validators
        • file_markup
        • file_markup_files
        • file_markup_options
        • files_for_item
        • html_escape
        • html_purifier_config_setup
        • image_tag_attributes
        • item_citation
        • item_next
        • item_previous
        • item_search_filters
        • items_advanced_search_link_default_url
        • light_gallery_callbacks
        • locale
        • login_adapter
        • login_form
        • page_caching_blacklist
        • page_caching_whitelist
        • public_navigation_admin_bar
        • public_navigation_items
        • public_navigation_main
        • public_theme_name
        • response_contexts
        • search_element_texts
        • search_form
        • search_form_default_action
        • search_form_default_query
        • search_form_default_query_type
        • search_form_default_record_types
        • search_query_types
        • search_record_types
        • simple_search_default_uri
        • storage_path
        • system_info
        • theme_options
      • Database
      • File and Image Display
      • Records
      • Search
      • Text
      • Views
    • models
    • views/helpers
    • controllers
    • Packages
    • libraries/Omeka
    • Omeka REST API
  • Helping With Documentation
  • Registering a new module or theme with omeka.org
Omeka Classic
  • Reference
  • Filters
  • light_gallery_callbacks
  • View page source

light_gallery_callbacks

Added in version 3.2.

Usage

Filters the callbacks used by lightgallery. Adding to or modifying these callbacks can be used to add support for more filetypes in the lightGallery viewer, or change how supported types are displayed.

The callbacks provided to this filter each take one argument, the File object for a file to display in the gallery viewer, and each return an array of HTML attributes to use in the lightGallery output for that file. See the Attributes page in the lightGallery documentation for a list of possible attributes and their usage.

Value

array $callbacks

Array of callbacks for the gallery viewer. The keys are each mimetypes that should be supported by the gallery, and the values are PHP callables.

Arguments

This filter takes no additional arguments.

Examples

Add support for a filetype that needs to use a viewer with an iframe:

class MyPlugin extends Omeka_Plugin_AbstractPlugin
{
    protected $_filters = ['light_gallery_callbacks'];

    public filterLightGalleryCallbacks($callbacks, $args)
    {
        $callbacks['application/example-mime-type'] = 'MyPlugin::lightgallery';
        return $options;
    }

    public static function lightgallery($file)
    {
        $viewer = web_path_to('example/viewer.html');
        return [
            'data-iframe' => 'true',
            'data-iframe-title' => $file->getAltText(),
            'data-src' => $viewer . '?' . http_build_query(['file' => $file->getWebPath()]),
        ];
    }
}
Previous Next

© Copyright 2012-2023, Omeka.

Built with Sphinx using a theme provided by Read the Docs.