public function LocalTaskDefault::getWeight in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/LocalTaskDefault.php \Drupal\Core\Menu\LocalTaskDefault::getWeight()
Returns the weight of the local task.
Return value
int The weight of the task. If not defined in the annotation returns 0 by default or -10 for the root tab.
Overrides LocalTaskInterface::getWeight
File
- core/
lib/ Drupal/ Core/ Menu/ LocalTaskDefault.php, line 91
Class
- LocalTaskDefault
- Default object used for LocalTaskPlugins.
Namespace
Drupal\Core\MenuCode
public function getWeight() {
// By default the weight is 0, or -10 for the root tab.
if (!isset($this->pluginDefinition['weight'])) {
if ($this->pluginDefinition['base_route'] == $this->pluginDefinition['route_name']) {
$this->pluginDefinition['weight'] = -10;
}
else {
$this->pluginDefinition['weight'] = 0;
}
}
return (int) $this->pluginDefinition['weight'];
}