You are here

class MenuLinkBinding in Drupal 7 to 8/9 Module Upgrader 8

Represents a standard menu link.

Hierarchy

  • class \Drupal\drupalmoduleupgrader\Routing\LinkBinding\LinkBinding

Expanded class hierarchy of MenuLinkBinding

1 file declares its use of MenuLinkBinding
Links.php in src/Plugin/DMU/Converter/Links.php

File

src/Routing/LinkBinding/MenuLinkBinding.php, line 8

Namespace

Drupal\drupalmoduleupgrader\Routing\LinkBinding
View source
class MenuLinkBinding extends LinkBinding {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $link = parent::build();
    $source = $this
      ->getSource();
    if ($source
      ->containsKey('description')) {
      $link['description'] = $source['description'];
    }
    $destination = $this
      ->getDestination();
    if ($destination
      ->hasParent()) {
      $link['parent'] = $destination
        ->getParent()
        ->getIdentifier();
    }
    return $link;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LinkBinding::$destination protected property
LinkBinding::$id protected property The link ID.
LinkBinding::$index protected property Index of all other links of this type.
LinkBinding::$source protected property
LinkBinding::getDestination public function Returns the Drupal 8 route in this binding.
LinkBinding::getIdentifier public function Returns the link's plugin ID.
LinkBinding::getSource public function Returns the Drupal 7 route in this binding.
LinkBinding::onIndexed public function React when the binding is added to an index.
LinkBinding::__construct public function Constructs a LinkBinding object. 1
MenuLinkBinding::build public function Builds the link definition. Overrides LinkBinding::build