You are here

public function MenuLinkContentService::clearMenuData in Menu Item Extras 8.2

Clears special menu or all menus extra data.

Parameters

string $menu_id: Machine menu name for clearing.

Overrides MenuLinkContentServiceInterface::clearMenuData

File

src/Service/MenuLinkContentService.php, line 137

Class

MenuLinkContentService
Class MenuLinkContentHelper.

Namespace

Drupal\menu_item_extras\Service

Code

public function clearMenuData($menu_id = 'all') {

  // Clears view mode field in menu db table.
  $query = $this->connection
    ->update('menu_link_content_data')
    ->fields([
    'view_mode' => NULL,
  ]);
  if ($menu_id !== 'all') {
    $query
      ->condition('menu_name', $menu_id);
  }
  $query
    ->execute();
}