public function BrowserGroupList::getLastGroup in Paragraphs Browser 8
Gets the last group in the list
Return value
\Drupal\paragraphs_browser\BrowserGroupItem
1 call to BrowserGroupList::getLastGroup()
- BrowserGroupList::addGroup in src/
BrowserGroupList.php - Adds group to end of groups list, resets weight to heaviest.
File
- src/
BrowserGroupList.php, line 92
Class
Namespace
Drupal\paragraphs_browserCode
public function getLastGroup() {
foreach ($this
->getGroups() as $group) {
if (!isset($weight)) {
$weight = $group
->getWeight();
$last = $group;
}
elseif ($group
->getWeight() > $weight) {
$weight = $group
->getWeight();
$last = $group;
}
}
return isset($last) ? $last : null;
}