eab / fancy-gallery-bundle
为eZ Publish提供的简单相册包,使用FancyBox。
Requires
- ezsystems/ezpublish-kernel: >=5.4|>=2014.11
- sp/bower-bundle: @stable
This package is not auto-updated.
Last update: 2024-09-14 18:47:27 UTC
README
##摘要
为eZ Publish提供的简单相册包,使用FancyBox。
##作者
Andy Caiger acaiger@eab.uk
版权
版权(C)2014-2015 Enterprise AB Ltd
许可
在GNU通用公共许可证2.0下许可
要求
安装
-
使用composer安装EabFancyGalleryBundle
composer require --update-no-dev --prefer-dist eab/fancy-gallery-bundle
Composer会安装包及其依赖项到
vendors
目录。您可以使用git将其安装到
src
子目录git clone https://github.com/eab-dev/EabFancyGalleryBundle.git src/Eab/FancyGalleryBundle
-
通过编辑
ezpublish/EzPublishKernel.php
在内核中启用该包public function registerBundles() { $bundles = array( // ... new Sp\BowerBundle\SpBowerBundle(), new Eab\FancyGalleryBundle\EabFancyGalleryBundle(), // ... ); }
-
安装最新版本的FancyBox
php ezpublish/console sp:bower:install php ezpublish/console assets:install --symlink
如果在安装bower资源时看到错误信息
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
快速解决方案是禁用git:
协议
git config --global url."https://".insteadOf git://
然后再次运行安装命令。
配置
如果您的包不是扩展eZDemoBundle,则需要告诉EabFancyGalleryBundle要使用哪个pagelayout模板。有两种简单的方法可以做到这一点
-
编辑
ezpublish/config/config.yml
eab_fancy_gallery: pagelayout: AcmeMyBundle::pagelayout.html.twig
-
在自己的包中,编辑一个文件,例如
src/Acme/MyBundle/Resources/config/services.yml
并添加parameters: eab_fancy_gallery.pagelayout: AcmeMyBundle::pagelayout.html.twig
使用第二种方法,请确保您的包在EabFancyGalleryBundle之后加载。
#自定义
以下设置可以像pagelayout
一样进行配置
summary_in_full_view
- 是否显示摘要page_limit
- 每页显示的图片数量children_types
- 应在画廊中显示的内容类型数组image_variation
- 用于缩略图的图像变体
您还可以通过将Resources/config/override.yaml
复制到您自己的包配置中并更改控制器或模板(提示:更改键,例如将image:
更改为image_override:
)来覆盖模板。
画廊模板加载了FancyBox CSS。如果您想在所有页面上加载它,则需要
-
用您的模板覆盖
full/gallery.html.twig
,该模板不加载CSS。 -
编辑您的
page_header_style.html.twig
模板并包含FancyBox CSS资产{% stylesheets filter='cssrewrite,?cssmin' ... 'bundles/eabfancygallery/components/fancybox/source/jquery.fancybox.css' ... %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}"/> {% endstylesheets %}
#更新
安装此包后,您可以在任何时候运行ezpublish/console sp:bower:install
来更新Fancybox资产。请注意:它将更新其他bower资产!
注意事项
-
此包假设您的网站使用Bootstrap 3。如果它不这样做,您需要覆盖和修改模板。请参阅Bootstrap 2的示例模板。
-
此包的配置不是siteaccess感知的。如果您的网站针对不同的siteaccess有不同的布局,您可以针对每个siteaccess覆盖画廊和图像模板,或者重新编程设置'pagelayout'模板变量的方式。因此,请分叉存储库,重写代码并提交拉取请求。谢谢!