Skip to content

Tribe Embeds Updates#17

Open
MlKilderkin wants to merge 26 commits intomainfrom
release-updates
Open

Tribe Embeds Updates#17
MlKilderkin wants to merge 26 commits intomainfrom
release-updates

Conversation

@MlKilderkin
Copy link
Copy Markdown
Contributor

What

This PR refactors the plugin architecture by splitting monolithic code into focused classes with dependency injection, introduces a factory pattern for video providers, and adds proper hook management. The changes improve maintainability and follow WordPress best practices.

  • Splits large Core class into specialized utility classes (Url_Parser, Thumbnail_Service, Facade_Builder, Block_Filter)
  • Introduces Provider_Factory for dynamic provider resolution with filtering capabilities
  • Replaces direct method calls with proper hook registration pattern
  • Add Wistia Provider Support

Copy link
Copy Markdown
Contributor

@LayaTaal LayaTaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MlKilderkin this is an awesome update. I love the reorganization of code and the new filters you created! I definitely think this makes sense to go to 1.2 or 2.0. Please see my comments. I didn't find any blockers, just some questions and ideas.

Comment thread tribe-embed.php Outdated
* Plugin URI: https://github.com/moderntribe/tribe-embed
* Description: A Tribe Embed Plugin.
* Version: 1.1.0
* Version: 1.1.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about bumping this to a 1.2 or 2.0 vesion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set 2.0

Comment thread readme.md Outdated
Comment thread readme.md
Comment thread readme.md Outdated
Comment thread readme.md Outdated
Comment thread readme.md
- `$by_provider` — List of hosts returned from `tribe_embeds_allowed_provider_hosts_<slug>`
- `$provider_class` — current provider class

#### `tribe_embeds_image_sizes_<slug>`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused on the intent and difference in the filter here and below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specific for provider. The below one is global version. In case you want catch all items one by one and not only the specific one

Comment thread src/Providers/Wistia.php
}

$image_url = strtok( $response_body[0]->thumbnail->url, '?' );
switch ( $resolution ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set a default in case neither 640 or 320 gets passed in?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated

Comment thread src/Providers/Wistia.php Outdated
Comment on lines +95 to +98
// Prevent edge case when `$image_data` may have boolean value
if ( ! is_array( $image_data ) || empty( $image_data ) ) {
$image_data = [];
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What causes this edge case? I'm wondering if we can type this earlier or fix it when originally set instead of a separate check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this

* @param array<string,mixed> $block
* @param string $video_id
*/
public function build( array $thumb, array $block, string $video_id, Provider $provider ): string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about approaching this by separating out markup into template files? I wonder if that might help separate concerns a bit more and allow for easily overriding templates in the future if we want. That might be beyond the scope of this PR but if you think it makes sense as an update, maybe drop a note?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually a good idea. We might need ticket it somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants