Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix PHP lint issues
  • Loading branch information
oandregal committed Dec 26, 2024
commit b4a54ef382b6bcfbcd92e77cdb503e4d98cbd113
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ static function ( $format ) {

if ( Hierarchical_Sort::is_eligible( $request ) ) {
$result = Hierarchical_Sort::run( $args );
$this->levels = $result[ 'levels' ];
$this->levels = $result['levels'];
Copy link

Choose a reason for hiding this comment

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

@oandregal: Correct me if I'm wrong, but this is the same problem that we had with static variables in the original Gutenberg PR. The concept of posts controller doesn't map 1:1 to the concept of a query, and so attaching the state of a query (levels) to a controller instance that can outlive it ($this) seems dangerous.


$args[ 'post__in' ] = $result[ 'post_ids' ];
$args[ 'orderby' ] = 'post__in';
$args['post__in'] = $result['post_ids'];
$args['orderby'] = 'post__in';
}

/**
Expand Down Expand Up @@ -3010,15 +3010,15 @@ public function get_collection_params() {
$post_type = get_post_type_object( $this->post_type );

if ( $post_type->hierarchical || 'attachment' === $this->post_type ) {
$query_params['parent'] = array(
$query_params['parent'] = array(
'description' => __( 'Limit result set to items with particular parent IDs.' ),
'type' => 'array',
'items' => array(
'type' => 'integer',
),
'default' => array(),
);
$query_params['parent_exclude'] = array(
$query_params['parent_exclude'] = array(
'description' => __( 'Limit result set to all items except those of a particular parent ID.' ),
'type' => 'array',
'items' => array(
Expand Down
Loading