Skip to content

Commit c4be1e7

Browse files
authored
Merge pull request #606 from BastianBalthasarBux/master
[TASK] Rework social media fields
2 parents 37fdc98 + 2039cac commit c4be1e7

File tree

6 files changed

+187
-52
lines changed

6 files changed

+187
-52
lines changed

Classes/Domain/Model/Address.php

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ class Address extends AbstractEntity
4444
protected string $mobile = '';
4545
protected string $www = '';
4646
protected string $slug = '';
47-
protected string $skype = '';
47+
protected string $linkedincompany = '';
48+
protected string $youtubechannel = '';
49+
protected string $bluesky = '';
50+
protected string $whatsapp = '';
4851

4952
protected string $twitter = '';
5053
protected string $facebook = '';
@@ -283,16 +286,6 @@ public function getSlug(): string
283286
return $this->slug;
284287
}
285288

286-
public function setSkype(string $skype): void
287-
{
288-
$this->skype = $skype;
289-
}
290-
291-
public function getSkype(): string
292-
{
293-
return $this->skype;
294-
}
295-
296289
public function setTwitter(string $twitter): void
297290
{
298291
if ($twitter[0] !== '@') {
@@ -351,6 +344,46 @@ public function getLinkedin(): string
351344
return $this->linkedin;
352345
}
353346

347+
public function setLinkedincompany(string $linkedincompany): void
348+
{
349+
$this->linkedincompany = $linkedincompany;
350+
}
351+
352+
public function getLinkedincompany(): string
353+
{
354+
return $this->linkedincompany;
355+
}
356+
357+
public function setBluesky(string $bluesky): void
358+
{
359+
$this->bluesky = $bluesky;
360+
}
361+
362+
public function getBluesky(): string
363+
{
364+
return $this->bluesky;
365+
}
366+
367+
public function setWhatsapp(string $whatsapp): void
368+
{
369+
$this->whatsapp = $whatsapp;
370+
}
371+
372+
public function getWhatsapp(): string
373+
{
374+
return $this->whatsapp;
375+
}
376+
377+
public function setYoutubechannel(string $youtubechannel): void
378+
{
379+
$this->youtubechannel = $youtubechannel;
380+
}
381+
382+
public function getYoutubechannel(): string
383+
{
384+
return $this->youtubechannel;
385+
}
386+
354387
public function setEmail(string $email): void
355388
{
356389
$this->email = $email;

Configuration/TCA/tt_address.php

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -273,20 +273,6 @@
273273
'type' => 'email',
274274
],
275275
],
276-
'skype' => [
277-
'exclude' => true,
278-
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.skype',
279-
'config' => [
280-
'type' => 'input',
281-
'size' => 20,
282-
'eval' => 'trim',
283-
'max' => 255,
284-
'placeholder' => 'johndoe',
285-
'behaviour' => [
286-
'allowLanguageSynchronization' => true,
287-
],
288-
],
289-
],
290276
'twitter' => [
291277
'exclude' => true,
292278
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.twitter',
@@ -309,7 +295,7 @@
309295
'size' => 20,
310296
'eval' => 'trim',
311297
'max' => 255,
312-
'placeholder' => '/johndoe',
298+
'placeholder' => 'johndoe',
313299
'behaviour' => [
314300
'allowLanguageSynchronization' => true,
315301
],
@@ -323,7 +309,7 @@
323309
'size' => 20,
324310
'eval' => 'trim',
325311
'max' => 255,
326-
'placeholder' => '@johndoe',
312+
'placeholder' => 'johndoe',
327313
'behaviour' => [
328314
'allowLanguageSynchronization' => true,
329315
],
@@ -357,6 +343,62 @@
357343
],
358344
],
359345
],
346+
'linkedincompany' => [
347+
'exclude' => true,
348+
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.linkedincompany',
349+
'config' => [
350+
'type' => 'input',
351+
'size' => 20,
352+
'eval' => 'trim',
353+
'max' => 255,
354+
'placeholder' => 'johndoe',
355+
'behaviour' => [
356+
'allowLanguageSynchronization' => true,
357+
],
358+
],
359+
],
360+
'bluesky' => [
361+
'exclude' => true,
362+
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.bluesky',
363+
'config' => [
364+
'type' => 'input',
365+
'size' => 20,
366+
'eval' => 'trim',
367+
'max' => 255,
368+
'placeholder' => 'johndoe',
369+
'behaviour' => [
370+
'allowLanguageSynchronization' => true,
371+
],
372+
],
373+
],
374+
'whatsapp' => [
375+
'exclude' => true,
376+
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.whatsapp',
377+
'config' => [
378+
'type' => 'input',
379+
'size' => 20,
380+
'eval' => 'trim',
381+
'max' => 255,
382+
'placeholder' => '4917012312312',
383+
'behaviour' => [
384+
'allowLanguageSynchronization' => true,
385+
],
386+
],
387+
],
388+
'youtubechannel' => [
389+
'exclude' => true,
390+
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.youtubechannel',
391+
'config' => [
392+
'type' => 'input',
393+
'size' => 20,
394+
'eval' => 'trim',
395+
'max' => 255,
396+
'placeholder' => '@johndoe',
397+
'behaviour' => [
398+
'allowLanguageSynchronization' => true,
399+
],
400+
],
401+
],
360402
'company' => [
361403
'exclude' => true,
362404
'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.organization',
@@ -554,9 +596,9 @@
554596
birthday',
555597
],
556598
'social' => [
557-
'showitem' => 'skype, twitter, --linebreak--,
558-
linkedin, tiktok, --linebreak--,
559-
facebook, instagram',
599+
'showitem' => 'bluesky, twitter, linkedin, --linebreak--,
600+
linkedincompany, facebook, instagram, --linebreak--,
601+
youtubechannel, tiktok, whatsapp, --linebreak--',
560602
],
561603
'paletteHidden' => [
562604
'showitem' => 'hidden',

Resources/Private/Language/locallang.xlf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,25 @@
4040
<source>Social media contacts</source>
4141
</trans-unit>
4242
<trans-unit id="label.twitter" xml:space="preserve" translate="no">
43-
<source>Twitter</source>
43+
<source>X (Twitter)</source>
4444
</trans-unit>
4545
<trans-unit id="label.facebook" xml:space="preserve" translate="no">
4646
<source>Facebook</source>
4747
</trans-unit>
4848
<trans-unit id="label.linkedin" xml:space="preserve" translate="no">
4949
<source>LinkedIn</source>
5050
</trans-unit>
51-
<trans-unit id="label.skype" xml:space="preserve" translate="no">
52-
<source>Skype</source>
51+
<trans-unit id="label.linkedincompany" xml:space="preserve">
52+
<source>LinkedIn Company profile</source>
53+
</trans-unit>
54+
<trans-unit id="label.bluesky" xml:space="preserve" translate="no">
55+
<source>BlueSky</source>
56+
</trans-unit>
57+
<trans-unit id="label.whatsapp" xml:space="preserve" translate="no">
58+
<source>WhatsApp</source>
59+
</trans-unit>
60+
<trans-unit id="label.youtubechannel" xml:space="preserve" translate="no">
61+
<source>Youtube Channel</source>
5362
</trans-unit>
5463
<trans-unit id="label.birthday" xml:space="preserve">
5564
<source>Birthday</source>

Resources/Private/Partials/Address.html

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,11 @@
7373
</f:section>
7474

7575
<f:section name="social">
76-
<f:if condition="{address.skype} || {address.twitter} || {address.facebook} || {address.linkedin}">
76+
<f:if condition="{address.twitter} || {address.facebook} || {address.linkedin} || {address.linkedincompany} || {address.whatsapp} || {address.bluesky} || {address.youtubechannel}">
7777
<ul class="list-inline">
78-
<f:if condition="{address.skype}">
79-
<li class="list-inline-item">
80-
<i class="fab fa-skype" aria-hidden title="{f:translate(key:'label.skype')}"></i>
81-
<span class="sr-only">{f:translate(key:'label.skype')}:</span>
82-
<a href="skype:{address.skype}?call">{address.skype}</a>
83-
<meta itemprop="sameAs" content="skype:{address.skype}?call"/>
84-
</li>
85-
</f:if>
8678
<f:if condition="{address.twitter}">
8779
<li class="list-inline-item">
88-
<i class="fab fa-twitter" aria-hidden title="{f:translate(key:'label.twitter')}"></i>
80+
<i class="fab fa-x-twitter" aria-hidden title="{f:translate(key:'label.twitter')}"></i>
8981
<span class="sr-only">{f:translate(key:'label.twitter')}:</span>
9082
<a href="https://twitter.com/{address.twitter}" target="_blank">{address.twitter}</a>
9183
<meta itemprop="sameAs" content="https://twitter.com/{address.twitter}"/>
@@ -107,6 +99,38 @@
10799
<meta itemprop="sameAs" content="https://www.linkedin.com/in/{address.linkedin}"/>
108100
</li>
109101
</f:if>
102+
<f:if condition="{address.linkedincompany}">
103+
<li class="list-inline-item">
104+
<i class="fab fa-linkedin" aria-hidden title="{f:translate(key:'label.linkedin')}"></i>
105+
<span class="sr-only">{f:translate(key:'label.linkedin')}:</span>
106+
<a href="https://www.linkedin.com/company/{address.linkedincompany}" target="_blank">{address.linkedincompany}</a>
107+
<meta itemprop="sameAs" content="https://www.linkedin.com/company/{address.linkedincompany}"/>
108+
</li>
109+
</f:if>
110+
<f:if condition="{address.whatsapp}">
111+
<li class="list-inline-item">
112+
<i class="fab fa-whatsapp" aria-hidden title="{f:translate(key:'label.whatsapp')}"></i>
113+
<span class="sr-only">{f:translate(key:'label.whatsapp')}:</span>
114+
<a href="https://wa.me/{address.whatsapp}">{address.whatsapp}</a>
115+
<meta itemprop="sameAs" content="https://wa.me/{address.whatsapp}"/>
116+
</li>
117+
</f:if>
118+
<f:if condition="{address.bluesky}">
119+
<li class="list-inline-item">
120+
<i class="fab fa-bluesky" aria-hidden title="{f:translate(key:'label.bluesky')}"></i>
121+
<span class="sr-only">{f:translate(key:'label.bluesky')}:</span>
122+
<a href="https://bsky.app/profile/{address.bluesky}" target="_blank">{address.bluesky}</a>
123+
<meta itemprop="sameAs" content="https://bsky.app/profile/{address.bluesky}"/>
124+
</li>
125+
</f:if>
126+
<f:if condition="{address.youtubechannel}">
127+
<li class="list-inline-item">
128+
<i class="fab fa-youtube" aria-hidden title="{f:translate(key:'label.youtubechannel')}"></i>
129+
<span class="sr-only">{f:translate(key:'label.youtubechannel')}:</span>
130+
<a href="https://www.youtube.com/{address.youtubechannel}" target="_blank">{address.youtubechannel}</a>
131+
<meta itemprop="sameAs" content="https://www.youtube.com/{address.youtubechannel}"/>
132+
</li>
133+
</f:if>
110134
</ul>
111135
</f:if>
112136
</f:section>

Tests/Unit/Domain/Model/AddressTest.php

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,6 @@ public function slugCanBeSet()
234234
self::assertEquals($value, $this->subject->getSlug());
235235
}
236236

237-
#[\PHPUnit\Framework\Attributes\Test]
238-
public function skypeCanBeSet()
239-
{
240-
$value = 'fo.com';
241-
$this->subject->setSkype($value);
242-
self::assertEquals($value, $this->subject->getSkype());
243-
}
244-
245237
#[\PHPUnit\Framework\Attributes\Test]
246238
public function twitterCanBeSet()
247239
{
@@ -286,6 +278,38 @@ public function linkedinCanBeSet()
286278
self::assertEquals($value, $this->subject->getLinkedin());
287279
}
288280

281+
#[\PHPUnit\Framework\Attributes\Test]
282+
public function linkedincompanyCanBeSet()
283+
{
284+
$value = 'bar';
285+
$this->subject->setLinkedincompany($value);
286+
self::assertEquals($value, $this->subject->getLinkedincompany());
287+
}
288+
289+
#[\PHPUnit\Framework\Attributes\Test]
290+
public function blueskyCanBeSet()
291+
{
292+
$value = 'bar';
293+
$this->subject->setBluesky($value);
294+
self::assertEquals($value, $this->subject->getBluesky());
295+
}
296+
297+
#[\PHPUnit\Framework\Attributes\Test]
298+
public function whatsappCanBeSet()
299+
{
300+
$value = '49123123123123';
301+
$this->subject->setWhatsapp($value);
302+
self::assertEquals($value, $this->subject->getWhatsapp());
303+
}
304+
305+
#[\PHPUnit\Framework\Attributes\Test]
306+
public function youtubechannelCanBeSet()
307+
{
308+
$value = 'bar';
309+
$this->subject->setYoutubechannel($value);
310+
self::assertEquals($value, $this->subject->getYoutubechannel());
311+
}
312+
289313
#[\PHPUnit\Framework\Attributes\Test]
290314
public function emailCanBeSet()
291315
{

ext_tables.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ CREATE TABLE tt_address (
2626
country varchar(128) DEFAULT '' NOT NULL,
2727
fax varchar(30) DEFAULT '' NOT NULL,
2828
description text,
29-
skype varchar(255) DEFAULT '',
3029
twitter varchar(255) DEFAULT '',
3130
facebook varchar(255) DEFAULT '',
3231
instagram varchar(255) DEFAULT '',
3332
tiktok varchar(255) DEFAULT '',
3433
linkedin varchar(255) DEFAULT '',
34+
linkedincompany varchar(255) DEFAULT '',
35+
bluesky varchar(255) DEFAULT '',
36+
whatsapp varchar(255) DEFAULT '',
37+
youtubechannel varchar(255) DEFAULT '',
3538
latitude decimal(10,8) default NULL,
3639
longitude decimal(11,8) default NULL,
3740

0 commit comments

Comments
 (0)