Commit 8b246745 authored by alexpott's avatar alexpott

Issue #2350941 by rpayanm | dawehner: Simplify $language max weight code using max().

parent 7340fee0
......@@ -338,8 +338,8 @@ public function updateLockedLanguageWeights() {
// Get maximum weight to update the system languages to keep them on bottom.
foreach ($this->getLanguages(LanguageInterface::STATE_CONFIGURABLE) as $language) {
if (!$language->isLocked() && $language->getWeight() > $max_weight) {
$max_weight = $language->getWeight();
if (!$language->isLocked()) {
$max_weight = max($max_weight, $language->getWeight());
}
}
......
......@@ -173,8 +173,8 @@ protected function getHighestConfigurableLanguageWeight(){
/* @var $languages \Drupal\Core\Language\LanguageInterface[] */
$languages = entity_load_multiple('configurable_language', NULL, TRUE);
foreach ($languages as $language) {
if (!$language->isLocked() && $language->getWeight() > $max_weight) {
$max_weight = $language->getWeight();
if (!$language->isLocked()) {
$max_weight = max($max_weight, $language->getWeight());
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment