class MenuItemExtrasCommands in Menu Item Extras 8.2
Class MenuItemExtrasCommands.
Hierarchy
- class \Drupal\menu_item_extras\Commands\MenuItemExtrasCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of MenuItemExtrasCommands
1 string reference to 'MenuItemExtrasCommands'
1 service uses MenuItemExtrasCommands
File
- src/
Commands/ MenuItemExtrasCommands.php, line 11
Namespace
Drupal\menu_item_extras\CommandsView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MenuItemExtrasCommands:: |
protected | property | Drupal\menu_item_extras\Service\MenuLinkContentServiceInterface definition. | |
MenuItemExtrasCommands:: |
public | function | Clear menu related data. | |
MenuItemExtrasCommands:: |
public | function | MenuItemExtrasCommands constructor. |