Add URL to tourist attraction (#87)

The tourist attraction can have an URL to their own website.
This URL is now imported and provided to templates.

Relates: #10193
This commit is contained in:
Daniel Siepmann 2022-11-29 11:50:22 +01:00 committed by GitHub
parent 35398b49c7
commit 20dc69694d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 54 additions and 24 deletions

View file

@ -232,6 +232,7 @@ class GeneralConverter implements Converter, LoggerAwareInterface
'opening_hours' => $entity instanceof Place ? $this->getOpeningHours($entity->getOpeningHoursSpecification()) : '', 'opening_hours' => $entity instanceof Place ? $this->getOpeningHours($entity->getOpeningHoursSpecification()) : '',
'special_opening_hours' => $entity instanceof Place ? $this->getOpeningHours($entity->getSpecialOpeningHoursSpecification()) : '', 'special_opening_hours' => $entity instanceof Place ? $this->getOpeningHours($entity->getSpecialOpeningHoursSpecification()) : '',
'address' => $entity instanceof Place ? $this->getAddress($entity) : '', 'address' => $entity instanceof Place ? $this->getAddress($entity) : '',
'url' => $entity->getUrls()[0] ?? '',
'offers' => $entity instanceof Place ? $this->getOffers($entity) : '', 'offers' => $entity instanceof Place ? $this->getOffers($entity) : '',
'other_service' => method_exists($entity, 'getOtherServices') ? implode(',', $entity->getOtherServices()) : '', 'other_service' => method_exists($entity, 'getOtherServices') ? implode(',', $entity->getOtherServices()) : '',
'traffic_infrastructure' => method_exists($entity, 'getTrafficInfrastructures') ? implode(',', $entity->getTrafficInfrastructures()) : '', 'traffic_infrastructure' => method_exists($entity, 'getTrafficInfrastructures') ? implode(',', $entity->getTrafficInfrastructures()) : '',

View file

@ -33,6 +33,11 @@ abstract class Place extends Base
*/ */
protected $address = null; protected $address = null;
/**
* @var string
*/
protected $url = '';
/** /**
* @var OpeningHours|null * @var OpeningHours|null
*/ */
@ -88,6 +93,11 @@ abstract class Place extends Base
return $this->address; return $this->address;
} }
public function getUrl(): string
{
return $this->url;
}
public function getOpeningHours(): ?OpeningHours public function getOpeningHours(): ?OpeningHours
{ {
return $this->openingHours; return $this->openingHours;

View file

@ -221,6 +221,14 @@ return (static function (string $extensionKey, string $tableName) {
'readOnly' => true, 'readOnly' => true,
], ],
], ],
'url' => [
'label' => $languagePath . '.url',
'l10n_mode' => 'exclude',
'config' => [
'type' => 'input',
'readOnly' => true,
],
],
'media' => [ 'media' => [
'label' => $languagePath . '.media', 'label' => $languagePath . '.media',
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
@ -311,7 +319,7 @@ return (static function (string $extensionKey, string $tableName) {
], ],
'types' => [ 'types' => [
'0' => [ '0' => [
'showitem' => '--palette--;;language, title, description, slogan, start_of_construction, sanitation, other_service, museum_service, architectural_style, traffic_infrastructure, payment_accepted, digital_offer, photography, pets_allowed, is_accessible_for_free, public_access, available_languages, distance_to_public_transport, opening_hours, special_opening_hours, offers, accessibility_specification, address, media, remote_id, --div--;' . $languagePath . '.tab.relations, town, managed_by, parking_facility_near_by', 'showitem' => '--palette--;;language, title, description, slogan, start_of_construction, sanitation, other_service, museum_service, architectural_style, traffic_infrastructure, payment_accepted, digital_offer, photography, pets_allowed, is_accessible_for_free, public_access, available_languages, distance_to_public_transport, opening_hours, special_opening_hours, offers, accessibility_specification, address, url, media, remote_id, --div--;' . $languagePath . '.tab.relations, town, managed_by, parking_facility_near_by',
], ],
], ],
]; ];

View file

@ -28,6 +28,8 @@ Features
* Allow to check if an opening hour is valid for a single day. * Allow to check if an opening hour is valid for a single day.
* The URL of attractions is now imported and provided to the template.
Fixes Fixes
----- -----

View file

@ -147,6 +147,9 @@
<trans-unit id="tx_thuecat_tourist_attraction.address" xml:space="preserve"> <trans-unit id="tx_thuecat_tourist_attraction.address" xml:space="preserve">
<source>Address</source> <source>Address</source>
</trans-unit> </trans-unit>
<trans-unit id="tx_thuecat_tourist_attraction.url" xml:space="preserve">
<source>Url</source>
</trans-unit>
<trans-unit id="tx_thuecat_tourist_attraction.media" xml:space="preserve"> <trans-unit id="tx_thuecat_tourist_attraction.media" xml:space="preserve">
<source>Media</source> <source>Media</source>
</trans-unit> </trans-unit>

View file

@ -16,6 +16,9 @@
<f:if condition="{address.fax}"> <f:if condition="{address.fax}">
{address.fax} {address.fax}
</f:if> </f:if>
<f:if condition="{url}">
<a href="{url}" referrerpolicy="no-referrer" rel="noreferrer noopener">{url}</a>
</f:if>
</p> </p>
</div> </div>
</html> </html>

View file

@ -23,7 +23,7 @@
<f:if condition="{entity.address}"> <f:if condition="{entity.address}">
<img src="{f:uri.resource(path:'Icons/icon-info.svg', extensionName:'Thuecat')}" width="30" class="svg-icon" alt="Address"> <img src="{f:uri.resource(path:'Icons/icon-info.svg', extensionName:'Thuecat')}" width="30" class="svg-icon" alt="Address">
<h2>{f:translate(id: 'content.address', extensionName: 'Thuecat')}</h2> <h2>{f:translate(id: 'content.address', extensionName: 'Thuecat')}</h2>
{f:render(partial: 'Address', arguments: {address: entity.address})} {f:render(partial: 'Address', arguments: {address: entity.address, url: entity.url})}
</f:if> </f:if>
<f:if condition="{entity.distanceToPublicTransport}"> <f:if condition="{entity.distanceToPublicTransport}">
<div class="distance-transport mt-5"> <div class="distance-transport mt-5">
@ -48,7 +48,7 @@
<f:if condition="{entity.address}"> <f:if condition="{entity.address}">
<img src="{f:uri.resource(path:'Icons/icon-info.svg', extensionName:'Thuecat')}" width="30" class="svg-icon" alt="Address"> <img src="{f:uri.resource(path:'Icons/icon-info.svg', extensionName:'Thuecat')}" width="30" class="svg-icon" alt="Address">
<h2>{f:translate(id: 'content.address', extensionName: 'Thuecat')}</h2> <h2>{f:translate(id: 'content.address', extensionName: 'Thuecat')}</h2>
{f:render(partial: 'Address', arguments: {address: entity.address})} {f:render(partial: 'Address', arguments: {address: entity.address, url: entity.url})}
</f:if> </f:if>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">

View file

@ -9,6 +9,7 @@
<media>[{"mainImage":true,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"author":"Image Author","license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom-und-Severikirche.jpg","description":"Sicht auf Dom St. Marien, St. Severikirche sowie die davor liegenden Klostergeb\u00e4ude und einem Ausschnitt des Biergartens umgeben von einem d\u00e4mmerungsverf\u00e4rten Himmel","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159186\/Preview-1280x0\/image","copyrightYear":2020,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}}]</media> <media>[{"mainImage":true,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"author":"Image Author","license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom-und-Severikirche.jpg","description":"Sicht auf Dom St. Marien, St. Severikirche sowie die davor liegenden Klostergeb\u00e4ude und einem Ausschnitt des Biergartens umgeben von einem d\u00e4mmerungsverf\u00e4rten Himmel","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159186\/Preview-1280x0\/image","copyrightYear":2020,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}}]</media>
<opening_hours>[{"opens":"09:30:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]},{"opens":"09:30:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday","PublicHolidays"]}]</opening_hours> <opening_hours>[{"opens":"09:30:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]},{"opens":"09:30:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday","PublicHolidays"]}]</opening_hours>
<address>{"street":"Beispielstraße 1a","zip":"99084","city":"Beispielstadt","email":"example@example.com","phone":"(0)30 23125 000","fax":"","geo":{"latitude":50.975955358589545,"longitude":11.023667024961856}}</address> <address>{"street":"Beispielstraße 1a","zip":"99084","city":"Beispielstadt","email":"example@example.com","phone":"(0)30 23125 000","fax":"","geo":{"latitude":50.975955358589545,"longitude":11.023667024961856}}</address>
<url>https://example.com/attraction</url>
<offers>[{"type":"GuidedTourOffer","title":"F\u00fchrungen","description":"Immer samstags, um 11:15 Uhr findet eine \u00f6ffentliche F\u00fchrung durch das Museum statt. Dauer etwa 90 Minuten","prices":[{"title":"Erwachsene","description":"","price":8,"currency":"EUR","rule":"PerPerson"},{"title":"Erm\u00e4\u00dfigt","description":"als erm\u00e4\u00dfigt gelten schulpflichtige Kinder, Auszubildende, Studierende, Rentner\/-innen, Menschen mit Behinderungen, Inhaber Sozialausweis der Landeshauptstadt Erfurt","price":5,"currency":"EUR","rule":"PerPerson"}]},{"type":"EntryOffer","title":"Eintritt","description":"Schulklassen und Kitagruppen im Rahmen des Unterrichts: Eintritt frei\nAn jedem ersten Dienstag im Monat: Eintritt frei","prices":[{"title":"Erm\u00e4\u00dfigt","description":"als erm\u00e4\u00dfigt gelten schulpflichtige Kinder, Auszubildende, Studierende, Rentner\/-innen, Menschen mit Behinderungen, Inhaber Sozialausweis der Landeshauptstadt Erfurt","price":5,"currency":"EUR","rule":"PerPerson"},{"title":"Familienkarte","description":"","price":17,"currency":"EUR","rule":"PerGroup"},{"title":"ErfurtCard","description":"","price":14.9,"currency":"EUR","rule":"PerPackage"},{"title":"Erwachsene","description":"","price":8,"currency":"EUR","rule":"PerPerson"}]}]</offers> <offers>[{"type":"GuidedTourOffer","title":"F\u00fchrungen","description":"Immer samstags, um 11:15 Uhr findet eine \u00f6ffentliche F\u00fchrung durch das Museum statt. Dauer etwa 90 Minuten","prices":[{"title":"Erwachsene","description":"","price":8,"currency":"EUR","rule":"PerPerson"},{"title":"Erm\u00e4\u00dfigt","description":"als erm\u00e4\u00dfigt gelten schulpflichtige Kinder, Auszubildende, Studierende, Rentner\/-innen, Menschen mit Behinderungen, Inhaber Sozialausweis der Landeshauptstadt Erfurt","price":5,"currency":"EUR","rule":"PerPerson"}]},{"type":"EntryOffer","title":"Eintritt","description":"Schulklassen und Kitagruppen im Rahmen des Unterrichts: Eintritt frei\nAn jedem ersten Dienstag im Monat: Eintritt frei","prices":[{"title":"Erm\u00e4\u00dfigt","description":"als erm\u00e4\u00dfigt gelten schulpflichtige Kinder, Auszubildende, Studierende, Rentner\/-innen, Menschen mit Behinderungen, Inhaber Sozialausweis der Landeshauptstadt Erfurt","price":5,"currency":"EUR","rule":"PerPerson"},{"title":"Familienkarte","description":"","price":17,"currency":"EUR","rule":"PerGroup"},{"title":"ErfurtCard","description":"","price":14.9,"currency":"EUR","rule":"PerPackage"},{"title":"Erwachsene","description":"","price":8,"currency":"EUR","rule":"PerPerson"}]}]</offers>
<slogan>Highlight</slogan> <slogan>Highlight</slogan>
<start_of_construction>11. Jh</start_of_construction> <start_of_construction>11. Jh</start_of_construction>

File diff suppressed because one or more lines are too long

View file

@ -79,6 +79,7 @@ class FrontendTest extends FunctionalTestCase
self::assertStringContainsString('Beispielstadt', (string)$result->getBody()); self::assertStringContainsString('Beispielstadt', (string)$result->getBody());
self::assertStringContainsString('example@example.com', (string)$result->getBody()); self::assertStringContainsString('example@example.com', (string)$result->getBody());
self::assertStringContainsString('(0)30 23125 000', (string)$result->getBody()); self::assertStringContainsString('(0)30 23125 000', (string)$result->getBody());
self::assertStringContainsString('https://example.com/attraction', (string)$result->getBody());
self::assertStringContainsString('Führungen', (string)$result->getBody()); self::assertStringContainsString('Führungen', (string)$result->getBody());
self::assertStringContainsString('(Führung)', (string)$result->getBody()); self::assertStringContainsString('(Führung)', (string)$result->getBody());

View file

@ -57,6 +57,7 @@ CREATE TABLE tx_thuecat_tourist_attraction (
opening_hours text, opening_hours text,
special_opening_hours text, special_opening_hours text,
address text, address text,
url text,
media text, media text,
offers text, offers text,
slogan text, slogan text,