Blender-org web-assets v2 upgrade #104116

Merged
Márton Lente merged 56 commits from web-assets-v2-upgrade into main 2024-08-13 17:27:59 +02:00
Showing only changes of commit 3373b96448 - Show all commits

View File

@ -30,6 +30,13 @@ if( !empty($block['align']) ) {
$className .= ' float-' . $block['align']; $className .= ' float-' . $block['align'];
} }
// Remove class "cards" from $className to apply "cards" on child wrapping element only.
Review

This whole section is about removing "cards" from $className. This gets added in line 15, you could also go there and rename it or not add it in the first place.

This whole section is about removing "cards" from $className. This gets added in line 15, you could also go there and rename it or not add it in the first place.
Review

The $className is used to render various classes on the parent element within the cards template based on Gutenberg editor settings. I'm not sure we can test all possibilities, but rendering $className on the parent's class attribute seems important to keep. I think removing line 15 $className = $className[1]; would break it, as the latter converts the array to an actual string.

cards is a reserved classname in BWA v2, and mustn't be present on the outer wrapper element that is needed here. Based on these, I think the substring replacement is needed for not to accidentally break some other settings I'm not aware of. 🤔

The `$className` is used to render various classes on the parent element within the `cards` template based on Gutenberg editor settings. I'm not sure we can test all possibilities, but rendering `$className` on the parent's _class_ attribute seems important to keep. I think removing _line 15_ `$className = $className[1];` would break it, as the latter converts the array to an actual string. _cards_ is a reserved classname in BWA v2, and mustn't be present on the outer wrapper element that is needed here. Based on these, I think the substring replacement is needed for not to accidentally break some other settings I'm not aware of. 🤔
// Check if $className contains "cards".
if (str_contains($className, "cards")) {
// Remove the substring "cards".
$className = str_replace("cards", "", $className);
}
// Load values and assign defaults. // Load values and assign defaults.
$card_layout = get_field('card_layout'); $card_layout = get_field('card_layout');
$cards_aspect_ratio = get_field('card_aspect_ratio'); $cards_aspect_ratio = get_field('card_aspect_ratio');