Skip to content

Commit fdf625d

Browse files
authored
Fix config:export:content:type (#2870)
1 parent 9cb5bd9 commit fdf625d

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

config/services/drupal-console/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ services:
2626
- { name: drupal.command }
2727
console.config_export_content_type:
2828
class: Drupal\Console\Command\Config\ExportContentTypeCommand
29-
arguments: ['@entity_type.manager', '@config.storage']
29+
arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager']
3030
tags:
3131
- { name: drupal.command }
3232
console.config_export_single:

src/Command/Config/ExportContentTypeCommand.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Drupal\Console\Command\Shared\CommandTrait;
1919
use Drupal\Console\Style\DrupalStyle;
2020
use Drupal\Console\Command\Shared\ExportTrait;
21+
use Drupal\Console\Extension\Manager;
2122

2223
class ExportContentTypeCommand extends Command
2324
{
@@ -30,19 +31,26 @@ class ExportContentTypeCommand extends Command
3031

3132
/** @var CachedStorage */
3233
protected $configStorage;
34+
35+
/** @var Manager */
36+
protected $extensionManager;
37+
3338
protected $configExport;
3439

3540
/**
3641
* ExportContentTypeCommand constructor.
3742
* @param EntityTypeManagerInterface $entityTypeManager
3843
* @param CachedStorage $configStorage
44+
* @param Manager $extensionManager
3945
*/
4046
public function __construct(
4147
EntityTypeManagerInterface $entityTypeManager,
42-
CachedStorage $configStorage
48+
CachedStorage $configStorage,
49+
Manager $extensionManager
4350
) {
4451
$this->entityTypeManager = $entityTypeManager;
4552
$this->configStorage = $configStorage;
53+
$this->extensionManager = $extensionManager;
4654
parent::__construct();
4755
}
4856

@@ -87,8 +95,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
8795
// --content-type argument
8896
$contentType = $input->getArgument('content-type');
8997
if (!$contentType) {
90-
$entityTypeManager = $this->getDrupalService('entity_type.manager');
91-
$bundles_entities = $entityTypeManager->getStorage('node_type')->loadMultiple();
98+
$bundles_entities = $this->entityTypeManager->getStorage('node_type')->loadMultiple();
9299
$bundles = array();
93100
foreach ($bundles_entities as $entity) {
94101
$bundles[$entity->id()] = $entity->label();

0 commit comments

Comments
 (0)