Problem/Motivation

While working with this module and Config_filter I noted that the config storage provided by this module was removing some empty arrays which were expected to exists.

For instance, consider this fragment of configuration:

[id] => node.win.teaser
    [targetEntityType] => node
    [bundle] => win
    [mode] => teaser
    [content] => Array
        (
            [body] => Array
                (
                    [type] => smart_trim
                    [weight] => 4
                    [region] => ds_content
                    [label] => visually_hidden
                    [settings] => Array
                        (
                            [trim_length] => 150
                            [trim_type] => chars
                            [trim_suffix] => ...
                            [wrap_class] => trimmed
                            [more_link] => 1
                            [more_text] => More »
                            [more_class] => card-more-link
                            [summary_handler] => full
                            [trim_options] => Array
                                (
                                    [text] => 1
                                    [trim_zero] =>
                                )

                            [wrap_output] =>
                        )

                    [third_party_settings] => Array
                        (
                        )

                )

The third_party_settings is an empty array and therefore is deleted when this module process the storage but this key is expected by any formatter plugin (see FormatterBase.php):

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings) {
    parent::__construct([], $plugin_id, $plugin_definition);

    $this->fieldDefinition = $field_definition;
    $this->settings = $settings;
    $this->label = $label;
    $this->viewMode = $view_mode;
    $this->thirdPartySettings = $third_party_settings;
  }

So, delete empty arrays could break the integrity of the configuration.

Proposed resolution

What needs to be done is remove the line which delete the empty arrays in ConfigSnapshotStorage::normalizeArray().

Remaining tasks

User interface changes

API changes

Data model changes

Comments

nedjo created an issue. See original summary.

  • nedjo committed e7b6b71 on 8.x-1.x
    Issue #3001243 by gnuget: normalizeArray shouldn't remove empty arrays
    

nedjo credited gnuget.

nedjo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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