mirror of
https://github.com/friendica/friendica
synced 2025-04-22 01:50:11 +00:00
Use the function from the contact template instead
This commit is contained in:
parent
91b0f2c486
commit
893f6bd692
7 changed files with 23 additions and 33 deletions
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
@ -77,9 +76,9 @@ class AllFriends extends BaseModule
|
|||
|
||||
$entries = [];
|
||||
foreach ($friends as $friend) {
|
||||
$contact = Model\Contact::getByURL($friend['url']);
|
||||
$contact = Model\Contact::getByURLForUser($friend['url'], local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[] = Model\Contact::getTemplateData($contact, ++$id);
|
||||
$entries[] = Contact::getContactTemplateVars($contact, ++$id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
|
@ -125,9 +124,9 @@ class BaseSearch extends BaseModule
|
|||
|
||||
// in case the result is a contact result, add a contact-specific entry
|
||||
if ($result instanceof ContactResult) {
|
||||
$contact = Model\Contact::getByURL($result->getUrl());
|
||||
$contact = Model\Contact::getByURLForUser($result->getUrl(), local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[] = Model\Contact::getTemplateData($contact, ++$id);
|
||||
$entries[] = Contact::getContactTemplateVars($contact, ++$id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1009,7 +1009,14 @@ class Contact extends BaseModule
|
|||
return $o;
|
||||
}
|
||||
|
||||
public static function getContactTemplateVars(array $rr)
|
||||
/**
|
||||
* Return the fields for the contact template
|
||||
*
|
||||
* @param array $rr Contact array
|
||||
* @param integer $id
|
||||
* @return array Template fields
|
||||
*/
|
||||
public static function getContactTemplateVars(array $rr, int $id = 0)
|
||||
{
|
||||
$dir_icon = '';
|
||||
$alt_text = '';
|
||||
|
@ -1069,12 +1076,16 @@ class Contact extends BaseModule
|
|||
'thumb' => Model\Contact::getThumb($rr),
|
||||
'name' => $rr['name'],
|
||||
'username' => $rr['name'],
|
||||
'details' => $rr['location'],
|
||||
'tags' => $rr['keywords'],
|
||||
'about' => $rr['about'],
|
||||
'account_type' => Model\Contact::getAccountType($rr),
|
||||
'sparkle' => $sparkle,
|
||||
'itemurl' => ($rr['addr'] ?? '') ?: $rr['url'],
|
||||
'url' => $url,
|
||||
'network' => ContactSelector::networkToName($rr['network'], $rr['url'], $rr['protocol']),
|
||||
'nick' => $rr['nick'],
|
||||
'id' => $id,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue