]> git.mxchange.org Git - friendica.git/commitdiff
Normalize template variables in Widget\VCard
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 8 Oct 2023 02:06:47 +0000 (22:06 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 8 Oct 2023 12:37:40 +0000 (08:37 -0400)
- Display new links in vier
- Address https://github.com/friendica/friendica/issues/13157#issuecomment-1751750581

src/Content/Widget/VCard.php
view/templates/widget/vcard.tpl
view/theme/frio/templates/widget/vcard.tpl

index d57f7130f9c64758c52f8de1a9f3cf5d21ad563b..1d5cde87b4794cac65d532a94d3c2410e667e511 100644 (file)
@@ -68,6 +68,8 @@ class VCard
                $follow_link      = '';
                $unfollow_link    = '';
                $wallmessage_link = '';
+               $mention_label    = '';
+               $mention_link     = '';
                $showgroup_link   = '';
 
                $photo   = Contact::getPhoto($contact);
@@ -102,15 +104,13 @@ class VCard
                        }
 
                        if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
-                               $mention_label   = DI::l10n()->t('Post to group');
-                               $mention_url     = 'compose/0?body=!' . $contact['addr'];
-                               $showgroup_label = DI::l10n()->t('View group');
-                               $showgroup_url   = 'network/group/' . $id;
+                               $mention_label  = DI::l10n()->t('Post to group');
+                               $mention_link   = 'compose/0?body=!' . $contact['addr'];
+                               $showgroup_link = 'network/group/' . $id;
                        } else {
                                $mention_label = DI::l10n()->t('Mention');
-                               $mention_url   = 'compose/0?body=@' . $contact['addr'];
+                               $mention_link  = 'compose/0?body=@' . $contact['addr'];
                        }
-
                }
 
                return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
@@ -131,8 +131,10 @@ class VCard
                        '$unfollow_link'    => $unfollow_link,
                        '$wallmessage'      => DI::l10n()->t('Message'),
                        '$wallmessage_link' => $wallmessage_link,
-                       '$mention'          => [$mention_label, $mention_url],
-                       '$showgroup'        => [$showgroup_label, $showgroup_url]
+                       '$mention'          => $mention_label,
+                       '$mention_link'     => $mention_link,
+                       '$showgroup'        => DI::l10n()->t('View group'),
+                       '$showgroup_link'   => $showgroup_link,
                ]);
        }
 }
index 9e38eebfc5514919614acc1703fdfeaf37e0489f..2656be487ee863f43f9a56f753c16d70e3943ff4 100644 (file)
                        {{if $wallmessage_link}}
                                <li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
                        {{/if}}
+                       {{if $mention_link}}
+                               <li><a id="mention-link" href="{{$mention_link}}">{{$mention}}</a></li>
+                       {{/if}}
+                       {{if $showgroup_link}}
+                               <li><a id="showgroup-link" href="{{$showgroup_link}}">{{$showgroup}}</a></li>
+                       {{/if}}
                </ul>
        </div>
 
index 814dec49edca10f5be53bc28a2efa824ed655068..9f030a8ef0a8faf25ebb29968cf3abcd58a0db7f 100644 (file)
                                        </button>
                                </div>
                        {{/if}}
-                        {{if $contact.addr}}
+                       {{if $mention_link}}
                                <div id="mention-link-button">
-                                       <button type="button" id="mention-link" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="openWallMessage('{{$mention.1}}')" titel="{{$mention.0}}" aria-label="{{$mention.0}}">
+                                       <button type="button" id="mention-link" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="openWallMessage('{{$mention_link}}')" title="{{$mention}}" aria-label="{{$mention}}">
                                                <span class=""><i class="fa fa-pencil-square-o"></i></span>
-                                               <span class="">{{$mention.0}}</span>
+                                               <span class="">{{$mention}}</span>
                                        </button>
                                </div>
-                        {{/if}}
-                        {{if $contact.forum==1 || $contact.prv==1}}
+                       {{/if}}
+                       {{if $showgroup_link}}
                                <div id="show-group-button">
-                                       <button type="button" id="show-group" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="window.location.href='{{$showgroup.1}}'">
+                                       <button type="button" id="show-group" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="window.location.href='{{$showgroup_link}}'" title="{{$showgroup}}" aria-label="{{$showgroup}}">
                                                <span class=""><i class="fa fa-group"></i></span>
-                                               <span class="">{{$showgroup.0}}</span>
+                                               <span class="">{{$showgroup}}</span>
                                        </button>
                                </div>
-                        {{/if}}
+                       {{/if}}
                </div>
 
                <div class="clear"></div>