You are here

class MenuItemExtrasCommands in Menu Item Extras 8.2

Class MenuItemExtrasCommands.

Hierarchy

Expanded class hierarchy of MenuItemExtrasCommands

1 string reference to 'MenuItemExtrasCommands'
drush.services.yml in ./drush.services.yml
drush.services.yml
1 service uses MenuItemExtrasCommands
menu_item_extras.drush_commands in ./drush.services.yml
Drupal\menu_item_extras\Commands\MenuItemExtrasCommands

File

src/Commands/MenuItemExtrasCommands.php, line 11

Namespace

Drupal\menu_item_extras\Commands
View source
class MenuItemExtrasCommands extends DrushCommands {

  /**
   * Drupal\menu_item_extras\Service\MenuLinkContentServiceInterface definition.
   *
   * @var \Drupal\menu_item_extras\Service\MenuLinkContentServiceInterface
   */
  protected $menuLinkContentService;

  /**
   * MenuItemExtrasCommands constructor.
   */
  public function __construct(MenuLinkContentServiceInterface $mie_service) {
    $this->menuLinkContentService = $mie_service;
  }

  /**
   * Clear menu related data.
   *
   * @param string $menu
   *   Menu name.
   *
   * @command menu-item-extras-clear-extra-data
   * @aliases mie:clear_data
   * @usage mie:clear_data "main"
   *   Clear extra data for the Main menu.
   * @usage mie:clear_data all
   *   Clear extra data for all menus.
   */
  public function clearExtraData($menu) {
    $this->menuLinkContentService
      ->clearMenuData($menu);
    if ($menu === 'all') {
      $this
        ->output()
        ->writeln('Extra data for all menus were deleted.');
    }
    else {
      $this
        ->output()
        ->writeln("Extra data for the '{$menu}' menus were deleted.");
    }
  }

}

Members