You are here

public function MenuLinkBase::getWeight in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkBase.php \Drupal\Core\Menu\MenuLinkBase::getWeight()
  2. 10 core/lib/Drupal/Core/Menu/MenuLinkBase.php \Drupal\Core\Menu\MenuLinkBase::getWeight()

Returns the weight of the menu link.

Return value

int The weight of the menu link, 0 by default.

Overrides MenuLinkInterface::getWeight

File

core/lib/Drupal/Core/Menu/MenuLinkBase.php, line 27

Class

MenuLinkBase
Defines a base menu link class.

Namespace

Drupal\Core\Menu

Code

public function getWeight() {

  // By default the weight is 0.
  if (!isset($this->pluginDefinition['weight'])) {
    $this->pluginDefinition['weight'] = 0;
  }
  return $this->pluginDefinition['weight'];
}