dev-master
9999999-devA simple gallery bundle for eZ Publish, using FancyBox
The Requires
by Andy Caiger
Wallogit.com
2017 © Pedro Peláez
A simple gallery bundle for eZ Publish, using FancyBox
A simple gallery bundle for eZ Publish, using FancyBox., (*1)
Andy Caiger acaiger@eab.uk, (*2)
Copyright (C) 2014-2015 Enterprise AB Ltd, (*3)
Licensed under GNU General Public License 2.0, (*4)
Install EabFancyGalleryBundle using composer:, (*5)
composer require --update-no-dev --prefer-dist eab/fancy-gallery-bundle
Composer will install the bundle and its dependencies into vendors., (*6)
You can use git to install into the src subtree:, (*7)
git clone https://github.com/eab-dev/EabFancyGalleryBundle.git src/Eab/FancyGalleryBundle
Enable the bundle in the kernel by editing ezpublish/EzPublishKernel.php:, (*8)
php
public function registerBundles()
{
$bundles = array(
// ...
new Sp\BowerBundle\SpBowerBundle(),
new Eab\FancyGalleryBundle\EabFancyGalleryBundle(),
// ...
);
}, (*9)
Install the latest version of FancyBox:, (*10)
php ezpublish/console sp:bower:install php ezpublish/console assets:install --symlink
If when installing the bower assets you see an error message like:, (*11)
ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/fancyapps/fancyBox.git", exit code of #128 fatal: unable to connect to github.com
the quick workaround is to disable the git: protocol:, (*12)
git config --global url."https://".insteadOf git://
and run the install command again., (*13)
If your bundle is not extending eZDemoBundle, you need to tell EabFancyGalleryBundle which pagelayout template to use. There are two easy ways to do this:, (*14)
Edit ezpublish/config/config.yml:, (*15)
eab_fancy_gallery:
pagelayout: AcmeMyBundle::pagelayout.html.twig
In your own bundle, edit a file such as src/Acme/MyBundle/Resources/config/services.yml and add:, (*16)
parameters:
eab_fancy_gallery.pagelayout: AcmeMyBundle::pagelayout.html.twig
With this second method make sure that your bundle is loaded after EabFancyGalleryBundle., (*17)
The following settings can be configured in the same way as pagelayout:, (*18)
summary_in_full_view - whether or not to show the summarypage_limit - number of images to show per pagechildren_types - array of content types that should be displayed in the galleryimage_variation - the image variation to use for thumbnailsYou can also override the templates by copying Resources/config/override.yaml
into your own bundle's configuration and changing the controllers or templates
(hint: change the keys e.g. change image: to image_override:)., (*19)
The FancyBox CSS is loaded by the gallery template. If you want to load it on all pages you need to:, (*20)
Override full/gallery.html.twig with your own template that doesn't load the CSS., (*21)
Edit your page_header_style.html.twig template and include the FancyBox CSS asset:, (*22)
{% stylesheets filter='cssrewrite,?cssmin'
...
'bundles/eabfancygallery/components/fancybox/source/jquery.fancybox.css'
...
%}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
{% endstylesheets %}
After installing this bundle you can run ezpublish/console sp:bower:install
to update the Fancybox assets at any time. Take care: it will update other
bower assets as well!, (*23)
This bundle assumes your website uses Bootstrap 3. If it doesn't you'll need to override and modify the templates. See the example template for Bootstrap 2., (*24)
The configuration for this bundle is not siteaccess aware. If your site has different layouts for different siteaccesses, you can either override the gallery and image templates for each of your siteaccesses, or else reprogram the way that the 'pagelayout' template variable is set. So please fork the repository, rewrite the code and issue a pull request. Thanks!, (*25)
A simple gallery bundle for eZ Publish, using FancyBox