Add external links for hotels to be used in maps

This commit is contained in:
Björn Fromme
2018-09-13 10:13:39 +02:00
parent 241dafb8fa
commit 3afb5a7fd6
6 changed files with 71 additions and 14 deletions
@@ -92,6 +92,7 @@ class MapController extends ActionController
$markerData[] = [
'name' => $product->getName(),
'uri' => $this->getUriForPageUid($product->getDetailPage()),
'externalLink' => $hotel->getExternalLink(),
'teaser' => $product->getTeaser(),
'lat' => $hotel->getLatitude(),
'lng' => $hotel->getLongitude(),
@@ -222,6 +222,11 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
*/
protected $facts;
/**
* @var string
*/
protected $externalLink;
public function __construct()
{
$this->initStorageObjects();
@@ -832,4 +837,20 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
$this->facts = $facts;
}
/**
* @return string
*/
public function getExternalLink()
{
return $this->externalLink;
}
/**
* @param string $externalLink
*/
public function setExternalLink($externalLink)
{
$this->externalLink = $externalLink;
}
}
@@ -22,14 +22,14 @@ return [
'endtime' => 'endtime',
],
'searchFields' => 'name,headline,teaser,description,features,room_types,additional_information,teaser_images,
header_images,images,reseller_images,code,type,category,country,region,city,teamer,products,',
header_images,images,reseller_images,code,type,category,country,region,city,teamer,products,external_link',
'iconfile' => 'EXT:ep_products/Resources/Public/Icons/tx_epproducts_domain_model_hotel.gif'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, detail_page, keywords,
address, longitude, latitude, headline, teaser, description, features, room_types, additional_information,
teaser_images, header_images, images, reseller_images, code, type, category, country, region, city, facts,
teamer, products, header_title,header_subtitle, earlybird, low_contingent, show_as_teaser',
teamer, products, header_title,header_subtitle, earlybird, low_contingent, show_as_teaser, external_link',
],
'types' => [
'1' => [
@@ -58,7 +58,7 @@ return [
],
],
'palettes' => [
'top' => ['showitem' => 'hidden,earlybird,low_contingent,show_as_teaser,--linebreak--,groupsch_id,detail_page'],
'top' => ['showitem' => 'hidden,earlybird,low_contingent,show_as_teaser,--linebreak--,groupsch_id,detail_page,--linebreak--,external_link'],
'geolocation' => ['showitem' => 'address, longitude, latitude'],
'destinations' => ['showitem' => 'country,region,city'],
'name' => ['showitem' => 'name,code,--linebreak--,header_title,header_subtitle'],
@@ -412,6 +412,29 @@ return [
'eval' => 'trim,int'
],
],
'external_link' => [
'exclude' => 0,
'label' => 'Externer Link (Google MyBusiness)',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim',
'wizards' => [
'link' => [
'type' => 'popup',
'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel',
'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif',
'module' => [
'name' => 'wizard_link',
'urlParameters' => [
'mode' => 'wizard'
]
],
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
]
],
],
],
'type' => [
'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_hotel.type',
@@ -208,6 +208,7 @@ CREATE TABLE tx_epproducts_domain_model_hotel (
reseller_images int(11) unsigned NOT NULL default '0',
code varchar(255) DEFAULT '' NOT NULL,
groupsch_id varchar(8) DEFAULT '' NOT NULL,
external_link varchar(255) DEFAULT '' NOT NULL,
type varchar(255) DEFAULT '' NOT NULL,
category int(11) DEFAULT '0' NOT NULL,
country int(11) unsigned DEFAULT '0',
@@ -21,6 +21,10 @@
markers: {
type: Array,
default: null
},
externalLink: {
type: String,
default: null
}
},
data () {
@@ -37,6 +41,11 @@
if (this.lat && this.lng) {
const position = L.latLng(this.lat, this.lng);
const marker = L.marker(position);
if (this.externalLink) {
marker.on('click', () => {
window.open(this.externalLink, '_blank');
});
}
marker.addTo(this.map);
this.map.setView(position);
} else if (this.markers) {
@@ -44,12 +53,16 @@
for (let item of this.markers) {
const position = L.latLng(item.lat, item.lng);
const marker = L.marker(position);
if (item.externalLink) {
marker.on('click', () => {
window.open(item.externalLink, '_blank');
});
} else {
const popupContent = '<div><strong>' + item.name + '</strong><br>' + item.teaser +
'<br><a href="' + item.uri + '">zu den Details</a></div>';
marker.bindPopup(popupContent);
}
marker.addTo(this.map);
const popupContent = '<div><strong>' + item.name + '</strong><br>' + item.teaser +
'<br><a href="' + item.uri + '">zu den Details</a></div>';
marker.bindPopup(popupContent);
bounds.extend(position);
}
this.map.fitBounds(bounds);
@@ -92,9 +92,8 @@
<div class="ep-sidebar ep-snow">
<p><strong>Lage</strong></p>
<div>
<a href="{ep:gmapsUrl(hotel: hotel)}" target="_blank" title="{hotel.name}">
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"></gmap>
</a>
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"
external-link="{f:uri.typolink(parameter: hotel.externalLink)}"></gmap>
</div>
</div>
<f:render partial="Region/Webcam" arguments="{region: region}"/>
@@ -192,9 +191,8 @@
<div class="ep-sidebar ep-snow">
<p><strong>Lage</strong></p>
<div>
<a href="{ep:gmapsUrl(hotel: hotel)}" target="_blank" title="{hotel.name}">
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"></gmap>
</a>
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"
external-link="{f:uri.typolink(parameter: hotel.externalLink)}"></gmap>
</div>
</div>
<f:render partial="Region/Webcam" arguments="{region: region}"/>