From: Michael Date: Sun, 9 Jul 2023 14:31:47 +0000 (+0000) Subject: New parameter to create a share block for display reasons X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b9bb525fe91c176ada2323c2d628291a27594d59;p=friendica.git New parameter to create a share block for display reasons --- diff --git a/src/Content/Item.php b/src/Content/Item.php index bfbf0795d2..d8e7cecc3c 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -669,14 +669,16 @@ class Item * Add a share block for the given item array * * @param array $item - * @param bool $add_media + * @param bool $add_media true = Media is added to the body + * @param bool $for_display true = The share block is used for display puposes, false = used for connectors, transport to other systems, ... * @return string */ - public function createSharedBlockByArray(array $item, bool $add_media = false): string + public function createSharedBlockByArray(array $item, bool $add_media = false, bool $for_display = false): string { if ($item['network'] == Protocol::FEED) { return PageInfo::getFooterFromUrl($item['plink']); - } elseif (!in_array($item['network'] ?? '', Protocol::FEDERATED)) { + } elseif (!in_array($item['network'] ?? '', Protocol::FEDERATED) && !$for_display) { + $item['guid'] = ''; $item['uri'] = ''; } diff --git a/src/Model/Item.php b/src/Model/Item.php index 425ba12ec1..9028c9f853 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3138,7 +3138,7 @@ class Item if (!empty($quote_uri_id)) { if (isset($shared_item['plink'])) { - $item['body'] .= "\n" . DI::contentItem()->createSharedBlockByArray($shared_item); + $item['body'] .= "\n" . DI::contentItem()->createSharedBlockByArray($shared_item, false, true); } else { DI::logger()->warning('Missing plink in shared item', ['item' => $item, 'shared' => $shared, 'quote_uri_id' => $quote_uri_id, 'shared_item' => $shared_item]); }