Merged
Conversation
Extract the poster attribute from WordPress video block HTML and include it as the icon property on ActivityPub Video attachments, allowing Mastodon and other platforms to display video thumbnails.
There was a problem hiding this comment.
Pull request overview
Adds federation support for WordPress video poster images by extracting the poster attribute and emitting it as icon on ActivityPub video attachments, plus related documentation/test updates.
Changes:
- Extract
posterfrom<video>HTML in video blocks and store it asiconin video media entries. - Prefer block-provided
iconwhen transforming attachments, falling back to transformerget_icon(). - Add/adjust PHPUnit coverage and PHPDoc (
@method) / param docs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/phpunit/tests/includes/transformer/class-test-post.php | Adds tests covering poster extraction and the “no poster” case for video blocks. |
| includes/transformer/class-post.php | Implements poster extraction from video block HTML and stores it as icon for video media. |
| includes/transformer/class-base.php | Documents icon in attachment media arrays and uses it to populate ActivityStreams icon. |
| .github/changelog/2982-from-description | Adds changelog entry for the new poster-image federation feature. |
- Replace regex with WP_HTML_Tag_Processor for parsing the video poster attribute, which properly handles HTML entities. - Use esc_url_raw() instead of esc_url() since the value goes into ActivityPub JSON, not HTML output. - Fix get_icon() return type to string|array|null.
Replace regex with WP_HTML_Tag_Processor for consistency with the video poster parsing and to properly handle HTML entities in alt attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported in https://wordpress.org/support/topic/videos-poster-image/
Proposed changes:
posterattribute from WordPress video block HTML (<video poster="...">) and include it as theiconproperty on ActivityPub Video attachments, so Mastodon and other platforms can display video thumbnails.@methodPHPDoc tags to the Base transformer class for child-implemented methods (get_content,get_icon,get_id,get_name,get_summary).Other information:
Testing instructions:
?activitypubto the post URL).iconproperty with the poster image URL.icon.Changelog entry
Changelog Entry Details
Significance
Type
Message
Add federation of video poster images set in the WordPress video block.