cgoit/contao-persons-bundle
Composer 安装命令:
composer require cgoit/contao-persons-bundle
包简介
Display data for commonly used persons in contao
README 文档
README
It often happens that information about people is displayed in many places on a web page. The particular challenge is to keep the individual places in the frontend consistent at all times.
With the help of this module, such people can be managed centrally in the backend of Contao in a clear list. The data from this list can then be easily used and displayed in different places in the frontend.
Install
composer require cgoit/contao-persons-bundle
BREAKING CHANGES
Starting with version 3.0.0 this extension uses TWIG templates instead of the deprecated html5 templates. You can still customize your templates. In the following table you can find an overview how the old templates map to the new ones.
| old HTML5 template | new TWIG template | |
|---|---|---|
| Content Element to display a list of persons | ce_person.html | content_element/persons.html.twig |
| Frontend module to display a list of persons | mod_person.html5 | frontend_module/persons.html.twig |
| Template for one person | person.html5 | component/person.html.twig |
Configuration
Since version 2.1.0 you can configure the contact information types via the standard mechanism. To do so
just add your configuration to the config/config.yml file.
The bundle ships with the following default configuration:
cgoit_persons: contact_types: email: schema_org_type: email phone: schema_org_type: telephone mobile: schema_org_type: telephone website: schema_org_type: url
If you want to add a new contact information type (e.g. fax) you'll have to configure the following:
cgoit_persons: contact_types: email: schema_org_type: email phone: schema_org_type: telephone mobile: schema_org_type: telephone website: schema_org_type: url fax: schema_org_type: faxNumber label: de: Fax en: Facsimile
By adding the label key to any existing contact_type you can overwrite the default translation (coming from $GLOBALS['TL_LANG']['tl_person']['contactInformation_type_options']['<type name>']).
Template Data
Since version 2.1.0 the contact information data is available in the template in two different ways:
- In the template you'll have access to an array
contactInfos. This array has entries for each contact information. Each entry is itself an array with three keys:type,labelandvalue. - Each contact information is available in the template. Each person has properties like
<type>(e.g.email) and<type>_label(e.g.email_label).
schema.org Data
Since version 2.1.0 you can add schema.org data to your templates like this:
<?php $this->extend('block_searchable'); ?> <?php $this->block('content'); ?> <div class="persons"> <?php foreach ($this->persons as $person): ?> <?php $this->insert($person->personTpl, $person->arrData); ?> <!-- add schema.org data --> <?php $this->addSchemaOrg($this->getSchemaOrgData($person)); ?> <?php endforeach; ?> </div> <?php $this->endblock(); ?>
cgoit/contao-persons-bundle 适用场景与选型建议
cgoit/contao-persons-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.8k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 10 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cgoit/contao-persons-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cgoit/contao-persons-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2023-10-02