Wordpress Rest:ACF到REST API过滤器致命错误

Developing an application using wordpress rest api for the backend.

I'm working with the following plugins:

Advanced Custom Fields PRO 5.5.14 ACF to REST API 3.10 Better REST API Featured Images 1.2.1 Custom Post Type UI 1.5.8

Result of endpoint wp-json / wp / v2 / games without filter:

enter image description here

I would like to filter post of type "games" by datas_plataforma.plataforma.slug

Something like:

  wp-json / wp / v2 / games? plataform-slug = {slug}

For this I tried the following filter in functions.php:

add_filter( 'acf/rest_api/games/get_fields', function( $data, $request, $response ) {
if ( $response instanceof WP_REST_Response ) {
    $data = $response->get_data();
}

if( isset( $data['acf']['datas_plataforma']['plataforma']['slug'] ) ) {
    $data['acf']['datas_plataforma']['plataforma']->acf = get_fields( $data['datas_plataforma']['plataforma']->SLUG );
}

return $data;

}, 10, 3);

But when I access the endopoint wp-json / wp / v2 / games I get error 500.

Update:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 2 passed in /opt/bitnami/apache2/htdocs/service/wp-includes/class-wp-hook.php on line 286 and exactly 3 expected in /opt/bitnami/apache2/htdocs/service/wp-content/themes/twentyseventeen/functions.php:657

Some help?