Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public function get_video_shortcodes( $html ) {
public function get_id_from_tag( $asset ) {
$attachment_id = false;
// Get attachment id from class name.
if ( preg_match( '#class=["|\']?[^"\']*wp-image-([\d]+)[^"\']*["|\']?#i', $asset, $found ) ) {
$attachment_id = intval( $found[1] );
if ( preg_match( '#class=["|\']?[^"\']*(wp-image-|wp-video-)([\d]+)[^"\']*["|\']?#i', $asset, $found ) ) {
$attachment_id = intval( $found[2] );
}

return $attachment_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function filter_video_tags( $content ) {
if ( false === $url ) {
continue;
}
$attachment_id = $this->media->get_id_from_url( $url );
$attachment_id = $this->media->filter->get_id_from_tag( $tag );
if ( empty( $attachment_id ) ) {
continue; // Missing or no attachment ID found.
}
Expand Down Expand Up @@ -450,6 +450,9 @@ public function filter_video_block_pre_render( $block, $source_block ) {
if ( ! empty( $source_block['attrs']['overwrite_transformations'] ) ) {
$classes .= ' cld-overwrite';
}
if ( ! empty( $source_block['attrs']['id'] ) ) {
$classes .= ' wp-video-' . $source_block['attrs']['id'];
}
foreach ( $block['innerContent'] as &$content ) {

$video_tags = $this->media->filter->get_media_tags( $content );
Expand Down