Skip to content
Snippets Groups Projects

Resolve #3537942 "Integrate experience builder"

Closes #3537942

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 3 commits

    • cef231be - 1 commit from branch project:3.x
    • 1c10933a - Merge remote-tracking branch 'origin/3.x' into 3537942-integrate-experience-builder
    • d3625644 - better tests

    Compare with previous version

  • Lio Novelli resolved all threads

    resolved all threads

  • Lio Novelli approved this merge request

    approved this merge request

  • added 1 commit

    Compare with previous version

  • Wolfgang Ziegler reset approvals from @useernamee by pushing to the branch

    reset approvals from @useernamee by pushing to the branch

  • added 1 commit

    • 72adf8d6 - implement renderless container

    Compare with previous version

  • 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') {
    • this was moved here, but code stays the same. does not matter whether it is in the top or not, it made more sense for me to move it down. I'd have preferred to get rid of this, but that would be BC-breaking, so it stays.

    • Please register or sign in to reply
  • Wolfgang Ziegler
  • 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);
  • added 1 commit

    Compare with previous version

  • Lio Novelli
  • 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;
  • Looks good. The only relevant remark is regarding the suggestions for templates in .module files

  • Lio Novelli approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading