You are here

public function LocalTaskLinkBinding::getParentID in Drupal 7 to 8/9 Module Upgrader 8

Gets the parent task's link ID, if any.

Return value

string|null

1 call to LocalTaskLinkBinding::getParentID()
LocalTaskLinkBinding::build in src/Routing/LinkBinding/LocalTaskLinkBinding.php
Builds the link definition.

File

src/Routing/LinkBinding/LocalTaskLinkBinding.php, line 70

Class

LocalTaskLinkBinding
Represents a local task or default local task.

Namespace

Drupal\drupalmoduleupgrader\Routing\LinkBinding

Code

public function getParentID() {
  $path = $this
    ->getSource()
    ->getParent()
    ->getPath()
    ->__toString();
  if ($this->index
    ->containsKey($path)) {
    return $this->index[$path]
      ->getIdentifier();
  }
  $parent = $this
    ->getDestination()
    ->getParent()
    ->getIdentifier();
  foreach ($this->linkManager
    ->getDefinitions() as $id => $link) {
    if ($link['route_name'] == $parent) {
      return $id;
    }
  }
}