public function LinkBindingFactory::create in Drupal 7 to 8/9 Module Upgrader 8
Factory method. Returns a link binding object appropriate for the source link type.
Parameters
\Drupal\drupalmoduleupgrader\Routing\Drupal7\RouteWrapper $source: The source (Drupal 7) route.
\Drupal\drupalmoduleupgrader\Routing\Drupal8\RouteWrapper $destination: The destination (Drupal 8) route.
Return value
mixed A link binding object; either an instance of this class or a subclass thereof.
File
- src/
Routing/ LinkBinding/ LinkBindingFactory.php, line 34
Class
- LinkBindingFactory
- Factory class to create link bindings, depending on the source route's type.
Namespace
Drupal\drupalmoduleupgrader\Routing\LinkBindingCode
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);
}
}
}