Problem

With #3555044: JSON output does not differentiate between props and slots the default JSON output changed, that leaked through to toArray(). While it makes a lot of sense for the JSON normalization to be explicit about props and slots, that's not necessarily desired when calling toArray. Let's add a new $explicit = FALSE flag which controls whether the output will be explicit about the output structure.

Steps to reproduce

Proposed resolution

Stay with $explicit FALSE by default. The normalizer should not make NOT-explicit output deprecated. That way the API for toArray() does not change.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs review
fago’s picture

implemented. also added a new ::toJson() helper that works now like toArray() before and respects the json-setting.

  • fago committed 81f80009 on 3.x
    fix: #3560533 CustomElement::toArray() output should not use explicit...
fago’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.