Warnings when uninstall

Created on 9 March 2023, almost 2 years ago
Updated 15 February 2024, 10 months ago

Problem/Motivation

drush pmu layout_builder_block_sanitizer, layout_builder_browser, layout_builder_component_attributes, layout_builder_enhancements, layout_builder_iframe_modal, layout_builder_styles, layout_builder_enhancements_views, layout_builder_enhancements_visual,

The following extensions will be uninstalled: layout_builder_block_sanitizer, layout_builder_browser, layout_builder_component_attributes, layout_builder_enhancements, layout_builder_iframe_modal, layout_builder_styles, layout_builder_enhancements_views, layout_builder_enhancements_visual

Do you really want to continue? (y/n): y
Invalid argument supplied for foreach()
layout_builder_component_attributes.install:52

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @SocialNicheGuru
  • πŸ‡ΊπŸ‡ΈUnited States Chris Burge

    It looks like we need to check if $third_party_settings['sections'] is set?

      // Loop through entity view displays, sections, and components.
      foreach ($view_displays as $display) {
        if (!$display instanceof LayoutBuilderEntityViewDisplay) {
          continue;
        }
        if ($display->isLayoutBuilderEnabled()) {
          $third_party_settings = $display->getThirdPartySettings('layout_builder');
    
          // Only track the entity type if overrides are enabled.
          if ($display->isOverridable()) {
            $lb_entity_types[] = $display->getTargetEntityTypeId();
          }
    
          foreach ($third_party_settings['sections'] as $section) { // <-- HERE
            $components = $section->getComponents();
            foreach ($components as $component) {
              // Remove 'component_attributes' from 'additional'.
              $additional = $component->get('additional');
              unset($additional['component_attributes']);
              $component->set('additional', $additional);
            }
          }
          $display
            ->setThirdPartySetting('layout_builder', 'sections', $third_party_settings['sections'])
            ->save();
        }
      }
    
Production build 0.71.5 2024