You are here

public function MenuLinkContentService::updateMenuItemBundle in Menu Item Extras 8.2

Update menu link item.

Parameters

\Drupal\menu_link_content\MenuLinkContentInterface $item: Menu item that required to be updated.

bool $extras_enabled: Flag of enabled functionality.

bool $save: Flag of saving after update.

Overrides MenuLinkContentServiceInterface::updateMenuItemBundle

1 call to MenuLinkContentService::updateMenuItemBundle()
MenuLinkContentService::updateMenuItemsBundle in src/Service/MenuLinkContentService.php
Update menu items.

File

src/Service/MenuLinkContentService.php, line 124

Class

MenuLinkContentService
Class MenuLinkContentHelper.

Namespace

Drupal\menu_item_extras\Service

Code

public function updateMenuItemBundle(MenuLinkContentInterface $item, $extras_enabled = TRUE, $save = FALSE) {
  $item
    ->set('bundle', $extras_enabled ? $item
    ->getMenuName() : $item
    ->getEntityTypeId());
  if ($save) {
    $item
      ->save();
  }
}