Skip to content
Snippets Groups Projects
Commit 6d135570 authored by catch's avatar catch
Browse files

Issue #3123209 by Hardik_Patel_12, nitesh624, _utsavsharma, Suresh Prabhu...

Issue #3123209 by Hardik_Patel_12, nitesh624, _utsavsharma, Suresh Prabhu Parkala, andypost, jungle, smustgrave, msuthars: Replace non-test usages of \Drupal::formBuilder() with IoC injection

(cherry picked from commit 9357f733)
parent 0908004b
Branches
Tags
30 merge requests!122353526426-warning-for-missing,!12212Issue #3445525 by alexpott, japerry, catch, mglaman, longwave: Add BC layer...,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!7078Issue #3320569 by Spokje, mondrake, smustgrave, longwave, quietone, Lendude,...,!6622Issue #2559833 by piggito, mohit_aghera, larowlan, guptahemant, vakulrai,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #110430 passed with warnings
Pipeline: drupal

#110447

    Pipeline: drupal

    #110441

      Pipeline: drupal

      #110439

        +1
        ......@@ -2,11 +2,13 @@
        namespace Drupal\action;
        use Drupal\action\Form\ActionAdminManageForm;
        use Drupal\Core\Action\ActionManager;
        use Drupal\Core\Entity\EntityInterface;
        use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
        use Drupal\Core\Entity\EntityStorageInterface;
        use Drupal\Core\Entity\EntityTypeInterface;
        use Drupal\Core\Form\FormBuilderInterface;
        use Symfony\Component\DependencyInjection\ContainerInterface;
        /**
        ......@@ -38,11 +40,22 @@ class ActionListBuilder extends ConfigEntityListBuilder {
        * The action storage.
        * @param \Drupal\Core\Action\ActionManager $action_manager
        * The action plugin manager.
        * @param \Drupal\Core\Form\FormBuilderInterface $formBuilder
        * The form builder.
        */
        public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ActionManager $action_manager) {
        public function __construct(
        EntityTypeInterface $entity_type,
        EntityStorageInterface $storage,
        ActionManager $action_manager,
        protected ?FormBuilderInterface $formBuilder = NULL,
        ) {
        parent::__construct($entity_type, $storage);
        $this->actionManager = $action_manager;
        if (!$formBuilder) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $formBuilder argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3159776', E_USER_DEPRECATED);
        $this->formBuilder = \Drupal::service('form_builder');
        }
        }
        /**
        ......@@ -52,7 +65,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
        return new static(
        $entity_type,
        $container->get('entity_type.manager')->getStorage($entity_type->id()),
        $container->get('plugin.manager.action')
        $container->get('plugin.manager.action'),
        $container->get('form_builder')
        );
        }
        ......@@ -108,7 +122,7 @@ public function getDefaultOperations(EntityInterface $entity) {
        * {@inheritdoc}
        */
        public function render() {
        $build['action_admin_manage_form'] = \Drupal::formBuilder()->getForm('Drupal\action\Form\ActionAdminManageForm');
        $build['action_admin_manage_form'] = $this->formBuilder->getForm(ActionAdminManageForm::class);
        $build['action_header']['#markup'] = '<h3>' . $this->t('Available actions:') . '</h3>';
        $build['action_table'] = parent::render();
        if (!$this->hasConfigurableActions) {
        ......
        ......@@ -13,6 +13,8 @@
        use Drupal\Core\Url;
        use Drupal\Core\Session\AccountInterface;
        use Drupal\Core\Block\BlockBase;
        use Drupal\Core\Form\FormBuilderInterface;
        use Drupal\user\Form\UserLoginForm;
        use Drupal\user\UserInterface;
        use Symfony\Component\DependencyInjection\ContainerInterface;
        ......@@ -49,11 +51,23 @@ class UserLoginBlock extends BlockBase implements ContainerFactoryPluginInterfac
        * The plugin implementation definition.
        * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
        * The route match.
        * @param \Drupal\Core\Form\FormBuilderInterface $formBuilder
        * The form builder.
        */
        public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match) {
        public function __construct(
        array $configuration,
        $plugin_id,
        $plugin_definition,
        RouteMatchInterface $route_match,
        protected ?FormBuilderInterface $formBuilder = NULL,
        ) {
        parent::__construct($configuration, $plugin_id, $plugin_definition);
        $this->routeMatch = $route_match;
        if (!$formBuilder) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $formBuilder argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3159776', E_USER_DEPRECATED);
        $this->formBuilder = \Drupal::service('form_builder');
        }
        }
        /**
        ......@@ -64,7 +78,8 @@ public static function create(ContainerInterface $container, array $configuratio
        $configuration,
        $plugin_id,
        $plugin_definition,
        $container->get('current_route_match')
        $container->get('current_route_match'),
        $container->get('form_builder')
        );
        }
        ......@@ -84,7 +99,7 @@ protected function blockAccess(AccountInterface $account) {
        * {@inheritdoc}
        */
        public function build() {
        $form = \Drupal::formBuilder()->getForm('Drupal\user\Form\UserLoginForm');
        $form = $this->formBuilder->getForm(UserLoginForm::class);
        unset($form['name']['#attributes']['autofocus']);
        $form['name']['#size'] = 15;
        $form['pass']['#size'] = 15;
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment