Skip to content
Snippets Groups Projects

Issue #3275451: Add save to library link to the built section preserve array key

Closed mschudders requested to merge issue/section_library-3275451:3275451-add-save-to into 1.0.x
1 file
+ 2
1
Compare changes
  • Side-by-side
  • Inline
@@ -82,6 +82,7 @@ class SectionLibraryRender implements TrustedCallbackInterface {
elseif (isset($section['configure']) && isset($section['configure']['#url'])) {
$params = $section['configure']['#url']->getRouteParameters();
// Pop the last item to add the link before it.
$last_item_section_key = array_key_last($sections[$key]);
$last_item_section = array_pop($sections[$key]);
$add_to_library_url = Url::fromRoute(
'section_library.add_section_to_library',
@@ -109,7 +110,7 @@ class SectionLibraryRender implements TrustedCallbackInterface {
'#access' => $add_to_library_url->access(),
];
// Push the last item again.
array_push($sections[$key], $last_item_section);
$sections[$key][$last_item_section_key] = $last_item_section;
}
}
Loading