Skip to content
Snippets Groups Projects

Adapt structure

1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
+ 5
5
@@ -79,10 +79,10 @@ class SectionLibraryRender implements TrustedCallbackInterface {
];
}
// Add save to library link to the built section.
elseif (isset($section['configure']) && isset($section['configure']['#url'])) {
$params = $section['configure']['#url']->getRouteParameters();
elseif (isset($section['section_links']['configure']) && isset($section['section_links']['configure']['#url'])) {
$params = $section['section_links']['configure']['#url']->getRouteParameters();
// Pop the last item to add the link before it.
$last_item_section = array_pop($sections[$key]);
$last_item_section = array_pop($sections[$key]['section_links']);
$add_to_library_url = Url::fromRoute(
'section_library.add_section_to_library',
[
@@ -102,14 +102,14 @@ class SectionLibraryRender implements TrustedCallbackInterface {
],
]
);
$sections[$key]['add_to_library'] = [
$sections[$key]['section_links']['add_to_library'] = [
'#type' => 'link',
'#title' => t('Add to Library'),
'#url' => $add_to_library_url,
'#access' => $add_to_library_url->access(),
];
// Push the last item again.
array_push($sections[$key], $last_item_section);
array_push($sections[$key]['section_links'], $last_item_section);
}
}
Loading