function MenuLinkBase::getOperations

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Menu/MenuLinkBase.php \Drupal\Core\Menu\MenuLinkBase::getOperations()

Overrides MenuLinkInterface::getOperations

1 method overrides MenuLinkBase::getOperations()
MenuLinkContent::getOperations in core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php
Provides an array of information to build a list of operation links.

File

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

Class

MenuLinkBase
Defines a base menu link class.

Namespace

Drupal\Core\Menu

Code

public function getOperations() : array {
    $operations = [];
    $operations['edit'] = [
        'title' => $this->t('Edit'),
        'url' => $this->getEditRoute(),
    ];
    // Links can either be reset or deleted, not both.
    if ($this->isResettable()) {
        $operations['reset'] = [
            'title' => $this->t('Reset'),
            'url' => $this->getResetRoute(),
        ];
    }
    elseif ($this->isDeletable()) {
        $operations['delete'] = [
            'title' => $this->t('Delete'),
            'url' => $this->getDeleteRoute(),
        ];
    }
    if ($this->isTranslatable()) {
        $operations['translate'] = [
            'title' => $this->t('Translate'),
            'url' => $this->getTranslateRoute(),
        ];
    }
    return $operations;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.