linkManager = $link_manager; } /** * Factory method. Returns a link binding object appropriate for the source link type. * * @param Drupal7Route $source * The source (Drupal 7) route. * @param Drupal8Route $destination * The destination (Drupal 8) route. * * @return mixed * A link binding object; either an instance of this class or a subclass thereof. */ public function create(Drupal7Route $source, Drupal8Route $destination) { if ($source->isLink()) { return new MenuLinkBinding($source, $destination); } elseif ($source->isLocalTask() || $source->isDefaultLocalTask()) { return new LocalTaskLinkBinding($source, $destination, $this->linkManager); } elseif ($source->isLocalAction()) { if ($source->isContextualLink()) { return new LinkBinding($source, $destination); } else { return new LocalActionLinkBinding($source, $destination); } } } }