manager->getUserAddressbooks() as $addressBook) { $result[$addressBook->getKey()] = $addressBook->getUri(); } return $result; } /** * Get (and load when needed) the address book URI for $key */ protected function getAddressBookUri(string $addressBookKey): ?string { $addressBooks = $this->getAddressBooksUris(); if (!array_key_exists($addressBookKey, $addressBooks)) { return null; } return $addressBooks[$addressBookKey]; } /** * @param IEntry $entry */ #[\Override] public function process(IEntry $entry) { $uid = $entry->getProperty('UID'); if (is_null($uid)) { // Nothing to do return; } if ($entry->getProperty('isLocalSystemBook') === true) { // Cannot show details -> ignore return; } $addressBookUri = $this->getAddressBookUri($entry->getProperty('addressbook-key')); $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/info.svg')); $contactsUrl = $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->linkToRoute('contacts.contacts.direct', [ 'contact' => base64_encode($uid . '~' . $addressBookUri), ]) ); $action = $this->actionFactory->newLinkAction($iconUrl, $this->l10n->t('Details'), $contactsUrl); $action->setPriority(0); $entry->addAction($action); } }