Chris@0: getThirdPartySettings('field_layout'); Chris@0: if (isset($field_layout['id'])) { Chris@0: $field_layout += ['settings' => []]; Chris@0: $display->appendSection(new Section($field_layout['id'], $field_layout['settings'])); Chris@0: } Chris@0: Chris@0: // Sort the components by weight. Chris@0: $components = $display->get('content'); Chris@0: uasort($components, 'Drupal\Component\Utility\SortArray::sortByWeightElement'); Chris@0: foreach ($components as $name => $component) { Chris@0: $display->setComponent($name, $component); Chris@0: } Chris@0: $display->save(); Chris@0: } Chris@0: Chris@0: // Clear the rendered cache to ensure the new layout builder flow is used. Chris@0: // While in many cases the above change will not affect the rendered output, Chris@0: // the cacheability metadata will have changed and should be processed to Chris@0: // prepare for future changes. Chris@0: Cache::invalidateTags(['rendered']); Chris@0: }