ApiLayoutController::get should not default model to stdClass

Created on 11 April 2025, 11 days ago

Overview

I just tried to use HEAD 0.x and can't edit pages:

GET /xb/api/layout/xb_page/1

{
    "message": "Drupal\\experience_builder\\Controller\\ApiLayoutController::extractModelForSubtree(): Argument #2 ($full_model) must be of type array, stdClass given, called in \/var\/www\/html\/docroot\/modules\/contrib\/experience_builder\/src\/Controller\/ApiLayoutController.php on line 344"
}

In \Drupal\experience_builder\Controller\ApiLayoutController::get I found:

      // Maps to the `inputs` property of the XB field type.
      // @see \Drupal\experience_builder\Plugin\DataType\ComponentInputs
      // @todo Settle on final names and get in sync.
      // If the model is empty return an empty object to ensure it is encoded as
      // an object and not empty array.
      'model' => empty($model) ? new \stdClass() : $model,

Defaulting to stdClass breaks \Drupal\experience_builder\Controller\ApiLayoutController::extractModelForSubtree

Proposed resolution

Default to empty array

User interface changes

πŸ› Bug report
Status

Active

Version

0.0

Component

Internal HTTP API

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024