Skip to content

Conversation

@damsfx
Copy link
Contributor

@damsfx damsfx commented Feb 11, 2025

fix #23

This PR revert #46

@mjauvin
Copy link
Member

mjauvin commented Feb 11, 2025

@damsfx I would have thought the change below would work:

if (!empty($block['_config'])) {
    $config = json_decode($block['_config'], true);
} else {
    $config = static::getDefaultConfig($block['_group']);
}   

$partialData['config'] = $config;

@LukeTowers
Copy link
Member

@damsfx please merge in the latest main branch to fix the tests and remove the callable changes from this PR.

@damsfx
Copy link
Contributor Author

damsfx commented Feb 11, 2025

@damsfx I would have thought the change below would work:

if (!empty($block['_config'])) {
    $config = json_decode($block['_config'], true);
} else {
    $config = static::getDefaultConfig($block['_group']);
}   

$partialData['config'] = $config;

In this case you get config as stdClass or as an array depending on if you have open the inspector (config) of block in the backend.

@damsfx
Copy link
Contributor Author

damsfx commented Feb 11, 2025

@damsfx ... remove the callable changes from this PR.

@LukeTowers what do you mean!?
Sorry, it's been a long day at work and I'm not sure I understand what you're waiting for.

@damsfx damsfx closed this Feb 12, 2025
@damsfx damsfx deleted the config-as-array branch February 12, 2025 11:49
LukeTowers pushed a commit that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block config not always of the same type in block PHP section

3 participants