-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump Min WP Version to 6.4 #1287
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -794,11 +794,7 @@ protected function get_classic_editor_images( $media, $max_images ) { | |
} | ||
|
||
if ( \count( $media['image'] ) <= $max_images ) { | ||
if ( \class_exists( '\WP_HTML_Tag_Processor' ) ) { | ||
$media['image'] = \array_merge( $media['image'], $this->get_classic_editor_image_embeds( $max_images ) ); | ||
} else { | ||
$media['image'] = \array_merge( $media['image'], $this->get_classic_editor_image_attachments( $max_images ) ); | ||
} | ||
$media['image'] = \array_merge( $media['image'], $this->get_classic_editor_image_embeds( $max_images ) ); | ||
} | ||
|
||
return $media; | ||
|
@@ -884,43 +880,6 @@ protected function get_classic_editor_image_embeds( $max_images ) { | |
return $images; | ||
} | ||
|
||
/** | ||
* Get image attachments from the classic editor. | ||
* This is imperfect as the contained images aren't necessarily the | ||
* same as the attachments. | ||
* | ||
* @param int $max_images The maximum number of images to return. | ||
* | ||
* @return array The attachment IDs. | ||
*/ | ||
protected function get_classic_editor_image_attachments( $max_images ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's keep that, for people that still use the classic editor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, this is only about the attachments 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to remove? |
||
// Max images can't be negative or zero. | ||
if ( $max_images <= 0 ) { | ||
return array(); | ||
} | ||
|
||
$images = array(); | ||
$query = new \WP_Query( | ||
array( | ||
'post_parent' => $this->item->ID, | ||
'post_status' => 'inherit', | ||
'post_type' => 'attachment', | ||
'post_mime_type' => 'image', | ||
'order' => 'ASC', | ||
'orderby' => 'menu_order ID', | ||
'posts_per_page' => $max_images, | ||
) | ||
); | ||
|
||
foreach ( $query->get_posts() as $attachment ) { | ||
if ( ! \in_array( $attachment->ID, $images, true ) ) { | ||
$images[] = array( 'id' => $attachment->ID ); | ||
} | ||
} | ||
|
||
return $images; | ||
} | ||
|
||
/** | ||
* Filter media IDs by object type. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep that, so that it will still work with classicpress or the classic editor enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functions exist with the classic editor enabled. Should ClassicPress be a consideration?