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