LocalTaskDefault::getWeight

public 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 89

Class

LocalTaskDefault
Default object used for LocalTaskPlugins.

Namespace

Drupal\Core\Menu

Code

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'];
}
doc_Drupal
2016-10-29 09:24:45
Comments
Leave a Comment

Please login to continue.