You need to sign in or sign up before continuing.
Resolve #3537942 "Integrate experience builder"
5 open threads
Closes #3537942
Merge request reports
Activity
- Resolved by Lio Novelli
reset approvals from @useernamee by pushing to the branch
60 // Special handling for "renderless-container" elements. Only slots are 61 // output, the element itself is not rendered. 62 if ($element->getTag() == 'renderless-container') { 63 // Merge all slots into a single array. 64 return call_user_func_array('array_merge', array_values($normalized_slots)); 65 } 66 else { 67 $result = array_merge($result, $normalized_slots); 68 } 69 70 // Special handling for "div" and "span" elements in JSON output. 71 // Those elements are used to wrap slot-content and should not be output as 72 // separate elements in the JSON structure. 73 // @todo Consider using renderless-container instead of div/span in 74 // in slot-helper-methods of CustomElement class. 75 if ($result['element'] == 'div' || $result['element'] == 'span') { - Resolved by Lio Novelli
44 $result[$key] = $normalizer->normalize($value); 45 } 46 else { 47 $result[$key] = $value; 48 } 52 49 } 53 catch (\Exception) { 54 // Fallback to basic conversion if serialization fails. 55 return $this->convertToSerializable($data); 56 } 57 }; 58 } 59 else { 60 // Fallback for when the service isn't available. 61 $serialize = function ($data) { 62 return $this->convertToSerializable($data); - Resolved by Lio Novelli
- tests/src/Kernel/RenderlessContainerTest.php 0 → 100644
153 154 /** 155 * Tests renderless-container with nested elements. 156 */ 157 public function testRenderlessContainerNested(): void { 158 // Create a more complex structure with nested elements. 159 $container = CustomElement::create('renderless-container'); 160 161 // Create a complex child with its own slots. 162 $complexChild = CustomElement::create('article') 163 ->setAttribute('class', 'article-wrapper'); 164 165 $header = CustomElement::create('header') 166 ->setSlot('default', 'Article Header'); 167 168 $content = CustomElement::create('div') 29 'base hook' => 'custom_element', 30 ], 28 31 ]; 29 32 } 30 33 34 /** 35 * Implements hook_theme_suggestions_HOOK(). 36 */ 37 function custom_elements_theme_suggestions_custom_element(array $variables) { 38 $suggestions = []; 39 /** @var \Drupal\custom_elements\CustomElement $custom_element */ 40 $custom_element = $variables['custom_element']; 41 42 // Add suggestion based on tag name. 43 $tag = str_replace('-', '_', $custom_element->getTag()); 44 $suggestions[] = 'custom_element__' . $tag;
Please register or sign in to reply