Verified Commit e29ebe89 authored by Dave Long's avatar Dave Long
Browse files

task: #3551738 Remove create method from controllers that use autowire trait

By: mstrelan
By: dcam
By: longwave
(cherry picked from commit 5cab397e)
parent 42372c26
Loading
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\RevisionLogInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Provides a controller showing revision history for an entity.
@@ -61,18 +60,6 @@ public function __construct(
    $this->languageManager = $languageManager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager'),
      $container->get('language_manager'),
      $container->get('date.formatter'),
      $container->get('renderer'),
    );
  }

  /**
   * Generates an overview table of revisions for an entity.
   *
+2 −13
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
use Drupal\editor\Entity\Editor;
use Drupal\file\Upload\FileUploadHandlerInterface;
use Drupal\file\Upload\FormUploadedFile;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -49,23 +49,12 @@ class CKEditor5ImageController extends ControllerBase {
  public function __construct(
    protected FileSystemInterface $fileSystem,
    protected FileUploadHandlerInterface $fileUploadHandler,
    #[Autowire(service: 'lock')]
    protected LockBackendInterface $lock,
    protected CKEditor5PluginManagerInterface $pluginManager,
  ) {
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('file_system'),
      $container->get('file.upload_handler'),
      $container->get('lock'),
      $container->get('plugin.manager.ckeditor5.plugin')
    );
  }

  /**
   * Uploads and saves an image from a CKEditor 5 POST.
   *
+0 −10
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\Schema\SchemaIncompleteException;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Controller for testing \Drupal\Core\Config\Development\ConfigSchemaChecker.
@@ -24,15 +23,6 @@ public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('config.factory')
    );
  }

  /**
   * Tests the BrowserTestBase tests can use strict schema checking.
   */
+11 −17
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;

@@ -93,7 +93,16 @@ class ConfigTranslationController extends ControllerBase {
   * @param \Drupal\Core\Render\RendererInterface $renderer
   *   The renderer.
   */
  public function __construct(ConfigMapperManagerInterface $config_mapper_manager, AccessManagerInterface $access_manager, RequestMatcherInterface $router, InboundPathProcessorInterface $path_processor, AccountInterface $account, LanguageManagerInterface $language_manager, RendererInterface $renderer) {
  public function __construct(
    ConfigMapperManagerInterface $config_mapper_manager,
    AccessManagerInterface $access_manager,
    #[Autowire(service: 'router')]
    RequestMatcherInterface $router,
    InboundPathProcessorInterface $path_processor,
    AccountInterface $account,
    LanguageManagerInterface $language_manager,
    RendererInterface $renderer,
  ) {
    $this->configMapperManager = $config_mapper_manager;
    $this->accessManager = $access_manager;
    $this->router = $router;
@@ -103,21 +112,6 @@ public function __construct(ConfigMapperManagerInterface $config_mapper_manager,
    $this->renderer = $renderer;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('plugin.manager.config_translation.mapper'),
      $container->get('access_manager'),
      $container->get('router'),
      $container->get('path_processor_manager'),
      $container->get('current_user'),
      $container->get('language_manager'),
      $container->get('renderer')
    );
  }

  /**
   * Language translations overview page for a configuration name.
   *
+0 −12
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Base class for entity translation controllers.
@@ -37,17 +36,6 @@ public function __construct(
  ) {
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('content_translation.manager'),
      $container->get('entity_field.manager'),
      $container->get('datetime.time'),
    );
  }

  /**
   * Populates target values with the source values.
   *
Loading