Skip to content

Commit

Permalink
Merge pull request #456 from helsingborg-stad/3.0/fix/contacts-v2-mod…
Browse files Browse the repository at this point in the history
…ule-errors

3.0/fix/contacts v2 module errors
  • Loading branch information
Anna authored Sep 8, 2023
2 parents 2a6f545 + 02dfe45 commit 6f3c725
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions source/php/Module/Contacts/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ public function prepareContacts($contacts)

case 'user':
$info = apply_filters('Modularity/mod-contacts/contact-info', array(
'id' => $contact['user']['ID'],
'id' => !empty($contact['user']['ID']) ? $contact['user']['ID'] : '',
'image' => null,
'first_name' => $contact['user']['user_firstname'],
'last_name' => $contact['user']['user_lastname'],
'first_name' => !empty($contact['user']['user_firstname']) ? $contact['user']['user_firstname'] : '',
'last_name' => !empty($contact['user']['user_lastname']) ? $contact['user']['user_lastname'] : '',
'work_title' => null,
'administration_unit' => null,
'email' => $this->hideField('email') ? null : strtolower($contact['user']['user_email']),
'email' => $this->hideField('email') ? null : strtolower(!empty($contact['user']['user_email']) ? $contact['user']['user_email'] : ''),
'phone' => null,
'address' => $this->hideField('address') ? null : strip_tags($contact['address'], '<br>'),
'address' => $this->hideField('address') ? null : strip_tags(!empty($contact['address']) ? $contact['address'] : '', '<br>'),
'visiting_address' => null,
'opening_hours' => null,
'other' => $contact['user']['user_description'],
'other' => !empty($contact['user']['user_description']) ? $contact['user']['user_description'] : '',
'hasBody' => $this->hasBody($contact)
), $contact, $contact['acf_fc_layout']);
break;
Expand Down
4 changes: 2 additions & 2 deletions source/php/Module/Contacts/views/cards.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if (!$hideTitle && !empty($postTitle))
@if (empty($hideTitle) && !empty($postTitle))
@typography([
'id' => 'mod-text-' . $ID .'-label',
'element' => 'h2',
Expand Down Expand Up @@ -26,7 +26,7 @@
'context' => 'module.contacts.card'
])

@if($showImages && $contact['image']['inlineStyle'])
@if(!empty($showImages) && !empty($contact['image']['inlineStyle']))
<div class="c-card__image">
<div class="c-card__image-background" alt="{{ $contact['full_name'] }}" style="{{ $contact['image']['inlineStyle'] }}"></div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions source/php/Module/Contacts/views/partials/information.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@
@includeWhen((count($title) > 0), 'components.title')

{{-- E-mail --}}
@includeWhen($contact['email'], 'components.email', ['icon' => 'email'])
@includeWhen(!empty($contact['email']), 'components.email', ['icon' => 'email'])

{{-- Phone --}}
@if ($contact['phone'])
@if (!empty($contact['phone']))
@foreach ($contact['phone'] as $phone)
@include('components.phone', ['icon' => 'phone'])
@endforeach
@endif

{{-- Social Media --}}
@if ($contact['social_media'])
@if (!empty($contact['social_media']))
@foreach ($contact['social_media'] as $media)
@include('components.social_media')
@endforeach
@endif

{{-- Opening Hours --}}
@includeWhen($contact['opening_hours'], 'components.opening_hours')
@includeWhen(!empty($contact['opening_hours']), 'components.opening_hours')

{{-- Address --}}
@includeWhen($contact['address'], 'components.adress')
@includeWhen(!empty($contact['address']), 'components.adress')

{{-- Visiting Address --}}
@includeWhen($contact['visiting_address'], 'components.visiting')
@includeWhen(!empty($contact['visiting_address']), 'components.visiting')

{{-- Other content data --}}
@includeWhen($contact['other'], 'components.other')
@includeWhen(!empty($contact['other']), 'components.other')
@endcollection
10 changes: 5 additions & 5 deletions source/php/Module/Contacts/views/partials/list_info.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
@endif

{{-- Social Media --}}
@if ($contact['social_media'])
@if (!empty($contact['social_media']))
@foreach ($contact['social_media'] as $media)
@include('components.social_media')
@endforeach
@endif

{{-- Opening Hours --}}
@includeWhen($contact['opening_hours'], 'components.opening_hours')
@includeWhen(!empty($contact['opening_hours']), 'components.opening_hours')

{{-- Address --}}
@includeWhen($contact['address'], 'components.adress')
@includeWhen(!empty($contact['address']), 'components.adress')

{{-- Visiting Address --}}
@includeWhen($contact['visiting_address'], 'components.visiting')
@includeWhen(!empty($contact['visiting_address']), 'components.visiting')

@if (!empty($module->post_content))
@collection__item([
Expand All @@ -42,7 +42,7 @@
@endcollection
@endif

@if ($contact['other'])
@if (!empty($contact['other']))
@collection__item([
'classList' => ['c-collection__other']
])
Expand Down

0 comments on commit 6f3c725

Please sign in to comment.