Input JSON schema. * @since 1.2.0 */ protected function move_input_schema(): array { $properties = $this->common_properties(); $properties['to_index'] = [ 'type' => 'integer', 'minimum' => 0, 'description' => 'New position among the block\'s siblings (same parent), as a logical index over the separator-filtered order: 0 = first. The block at `path` is moved there; other siblings shift to make room.', ]; return [ 'type' => 'object', 'properties' => $properties, 'required' => [ 'id', 'path', 'to_index' ], ]; } /** * Move reorders an existing block, so it runs no allowed-block policy check. * * @return bool Always false. * @since 1.2.0 */ protected function enforces_policy(): bool { return false; } /** * Apply the move to the tree. * * @param BlockTreeEditor $editor Tree editor. * @param array $tree Parsed block tree. * @param array $args Ability input. * @return array|WP_Error New tree, or an error. * @since 1.2.0 */ protected function apply( BlockTreeEditor $editor, array $tree, array $args ): array|WP_Error { $to_index = absint( $args['to_index'] ?? 0 ); return $editor->move( $tree, $this->read_path( $args ), $to_index, $this->read_expect( $args ) ); } }