You are here

public function MicrositeMenuItem::getEditRoute in Entity Reference Hierarchy 8.2

Same name and namespace in other branches
  1. 3.x modules/entity_hierarchy_microsite/src/Plugin/Menu/MicrositeMenuItem.php \Drupal\entity_hierarchy_microsite\Plugin\Menu\MicrositeMenuItem::getEditRoute()

Returns route information for a custom edit form for the menu link.

Plugins should return a value here if they have a special edit form, or if they need to define additional local tasks, local actions, etc. that are visible from the edit form.

Return value

\Drupal\Core\Url|null A Url object, or NULL if there is no route because there is no custom edit route for this instance.

Overrides MenuLinkBase::getEditRoute

File

modules/entity_hierarchy_microsite/src/Plugin/Menu/MicrositeMenuItem.php, line 110

Class

MicrositeMenuItem
Defines a class for a menu item based on hierarchy.

Namespace

Drupal\entity_hierarchy_microsite\Plugin\Menu

Code

public function getEditRoute() {
  if (!$this
    ->getOverrideEntity()
    ->isNew()) {
    return $this
      ->getOverrideEntity()
      ->toUrl('edit-form');
  }
  return new Url('entity.eh_microsite_menu_override.add', [
    'target' => $this
      ->getDerivativeId(),
  ]);
}