You are here

public function MenuLinkField::getWeight in Menu Link (Field) 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Menu/MenuLinkField.php \Drupal\menu_link\Plugin\Menu\MenuLinkField::getWeight()

Returns the weight of the menu link.

Return value

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

Overrides MenuLinkBase::getWeight

File

src/Plugin/Menu/MenuLinkField.php, line 138

Class

MenuLinkField
Provides a menu link plugin for field-based menu links.

Namespace

Drupal\menu_link\Plugin\Menu

Code

public function getWeight() {

  // By default the weight is 0.
  $weight = $this
    ->getProperty('weight');
  if (!$weight || !is_int($weight)) {
    return parent::getWeight();
  }
  return $weight;
}