cgoit / contao-persons-bundle
Display data for commonly used persons in contao
Installs: 1 325
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:contao-bundle
Requires
- php: ^8.1 || ^8.2 || ^8.3
- codefog/contao-haste: ^5.1
- codefog/tags-bundle: ^3.3
- contao/core-bundle: ^5.3
- doctrine/dbal: ^3.3
- mvo/contao-group-widget: ^1.5
- symfony/config: ^6.1
- symfony/dependency-injection: ^6.1
- symfony/event-dispatcher: ^6.1
- symfony/http-foundation: ^6.1
- symfony/http-kernel: ^6.1
Requires (Dev)
- contao/manager-plugin: ^2.0
- phpunit/phpunit: ^10.3
- terminal42/contao-build-tools: dev-main
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
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
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
,label
andvalue
. - 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(); ?>