From 7082582655a97a2c746bc740fe7184565c721707 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 16 Aug 2021 05:28:08 -0400 Subject: [PATCH] Add the attachments to the $item for the prepare_body_content_filter hook - Allows filtering on attachments that are added later to the post content --- src/Model/Item.php | 2 ++ src/Model/Post/Media.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index beb7db5764..c683e10e78 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2757,6 +2757,8 @@ class Item $filter_reasons[] = DI::l10n()->t('Content warning: %s', $item['content-warning']); } + $item['attachments'] = $attachments; + $hook_data = [ 'item' => $item, 'filter_reasons' => $filter_reasons diff --git a/src/Model/Post/Media.php b/src/Model/Post/Media.php index 801f192e9d..fae71a9536 100644 --- a/src/Model/Post/Media.php +++ b/src/Model/Post/Media.php @@ -534,7 +534,7 @@ class Media * * @param int $uri_id * @param string $guid - * @param array $links ist of links that shouldn't be added + * @param array $links list of links that shouldn't be added * @return array attachments */ public static function splitAttachments(int $uri_id, string $guid = '', array $links = [])