heimrichhannot/contao-watchlist-bundle
Composer 安装命令:
composer require heimrichhannot/contao-watchlist-bundle
包简介
This utility bundle offers a flexible watchlist for the Contao CMS.
关键字:
README 文档
README
This utility bundle offers a flexible watch list for the Contao CMS.
Features
- add files or arbitrary contao database entities like
tl_newsortl_memberto a watch list - watch lists can be viewed in the contao backend, as well
- ajax handling for a fluent usage (data is always kept up-to-date)
- integrating the watch list is as easy as assigning a frontend module to a layout section and adding links by using insert tags
- download the files added to a watch list as a ZIP archive
- contains clean templates without css styling and templates prepared with bootstrap 5 css classes
- share watch lists via link (also to public) and copy to clipboard
Impressions
Watch list in frontend (here: bootstrap 5 template with modal integration)
Installation & configuration
- Run
composer require heimrichhannot/contao-watchlist-bundleand update your database. - Create a watch list config (select bootstrap 5 templates if applicable).
- Important: Assign the watch list config to your root page.
- Create a frontend module of type
watchlistand add it to a layout area of your website so that it comes with each and every sub page. Select bootstrap 5 custom template if needed. - Identify the template you'd like to integrate a link for adding this item to the watch list. Common situations are:
ce_download.html5ce_downloads.html5news_full.html5- ...
- Integrate the link for adding an item to the current watch list to any template by using inserttag or WatchlistLinkGenerator service.
Item types
A watch list in the context of this bundle can have multiple types of items:
File: Any file in the contao file managerEntity: Any database record (aka "entity"), e.g.tl_news,tl_member-> downloads aren't possible at the moment
Sharing watch lists
- Do the steps mentioned in "Installation & configuration"
- Create a target page for shared watch lists.
- In your watch list config activate the sharing feature.
- Create the list module for the share page. You have 2 options:
- For simpler needs and file-only watch lists: Create a frontend module of the type "watchlist_share_list". This module fulfills simple needs. Image watch list items are downloadable, entity items are reachable by link.
- For more complex needs (like internal areas, filtering, ...): Create a list
using heimrichhannot/contao-list-bundle and a reader
using heimrichhannot/contao-reader-bundle.
-
Activate the option
actAsWatchlistShareTargetin the list and reader configs. -
Make sure, the
detailsUrlin the list item template contains thewatchlistGET parameter. For example, you could create a block for thedetailsUrl, extend your default template and override thedetailsUrl:{% block detailsUrl %} {{ detailsUrl }}?watchlist={{ app.request.get('watchlist') }} {% endblock %}
-
- Place the module created in the previous step on the page created in the second page.
Permission handling
A watch list is private to its owner. Who is the owner depends on the context, the watch list is used in:
| Context | Who is the watch list's owner? |
|---|---|
| Anonymous | The current PHP session ID is used as the author |
| Frontend login available | The current frontend user (member) is used as the author |
Hint: As watch lists are currently not transferable from session to member, consider showing the watch list only after login. If you have no frontend login situation, you can ignore that, of course.
Twig functions
The following twig functions are available:
| Function | Description |
|---|---|
watchlist_add_file(FilesModel|string|Uuid|FilesystemItem $file, ?string $title = null, ?string $watchlistUuid = null) |
Add a file to watchlist |
Insert tags
The following new insert tags are available. These take into account the translated jumpTo url and alias.
| Name | Example |
|---|---|
{{watchlist_add_item_link::file::<file uuid (string)>::<optional: title>::<optional: watch list uuid>}} |
{{watchlist_add_item_link::file::2e6b6f54-e4af-11eb-b4fc-001e678385c6}} |
{{watchlist_add_item_link::entity::<entity table>::<entity id>::<title>::<optional: entity url>::<optional: preview file uuid (string)>::<optional: watch list uuid>}} |
{{watchlist_add_item_link::entity::tl_news::1::My headline::https://example.org/my-entity::2e6b6f54-e4af-11eb-b4fc-001e678385c6}} |
Developers
WatchlistLinkGenerator
Add the "Add to watchlist" button from your code:
use Contao\Template; use HeimrichHannot\WatchlistBundle\Generator\WatchlistLinkGenerator; function templateListener(Template $template, WatchlistLinkGenerator $linkGenerator) { $template->addButton = $linkGenerator->generateAddFileLink($template->singleSrc, $template->fileTitle); }
Symfony Events
| Event | Description |
|---|---|
| WatchlistItemDataEvent | Modify the watchlist item before output to the watchlist module. |
JavaScript events
| Event | Description |
|---|---|
| huh_watchlist_list_updated | Is dispatched after the watchlist content is updated. |
heimrichhannot/contao-watchlist-bundle 适用场景与选型建议
heimrichhannot/contao-watchlist-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.7k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「contao」 「watchlist」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 heimrichhannot/contao-watchlist-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 heimrichhannot/contao-watchlist-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 heimrichhannot/contao-watchlist-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Contao Open Source CMS
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Implementation of carouFredSel as extension for Contao Open Source CMS
Contao CMS integrity check for some files
Contao 4 bundle for a Facebook login.
统计信息
- 总下载量: 1.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2018-04-26
