[advancedcontentfilter] Add new attachments key in filter

- Follows a change in Model\Item::prepareBody to enable filtering on attachments (images, sounds, videos, downloads...)
This commit is contained in:
Hypolite Petovan 2021-08-16 05:29:17 -04:00
parent 1544fed2b9
commit b141416b51

View file

@ -282,6 +282,7 @@ function advancedcontentfilter_build_fields($data)
'event_created', 'event_edited', 'event_start', 'event_finish', 'event_summary',
'event_desc', 'event_location', 'event_type', 'event_nofinish', 'event_adjust', 'event_ignore',
'children', 'pagedrop', 'tags', 'hashtags', 'mentions',
'attachments',
];
$expressionLanguage = new ExpressionLanguage\ExpressionLanguage();
@ -437,6 +438,10 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
$item['hashtags'] = $tags['hashtags'];
$item['mentions'] = $tags['mentions'];
$attachments = Post\Media::splitAttachments($item['uri-id'], $item['guid'] ?? '');
$item['attachments'] = $attachments;
$return = advancedcontentfilter_get_filter_fields($item);
return json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))]);