function EntityDisplayBase::getHighestWeight
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getHighestWeight()
- 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getHighestWeight()
- 11.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getHighestWeight()
Overrides EntityDisplayInterface::getHighestWeight
1 call to EntityDisplayBase::getHighestWeight()
- EntityDisplayBase::setComponent in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php, line 387
Class
- EntityDisplayBase
- Provides a common base class for entity view and form displays.
Namespace
Drupal\Core\EntityCode
public function getHighestWeight() {
$weights = [];
// Collect weights for the components in the display.
foreach ($this->content as $options) {
if (isset($options['weight'])) {
$weights[] = $options['weight'];
}
}
// Let other modules feedback about their own additions.
$weights = array_merge($weights, \Drupal::moduleHandler()->invokeAll('field_info_max_weight', [
$this->targetEntityType,
$this->bundle,
$this->displayContext,
$this->mode,
]));
return $weights ? max($weights) : NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.