Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LocalTaskDefault.php

function 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\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'];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal