summaryrefslogtreecommitdiffstats
path: root/core/modules/inline_form_errors/src/InlineFormErrorsServiceProvider.php
blob: 62afbf0dc07fd6e072d8541ccf6b41d2ff198e2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

namespace Drupal\inline_form_errors;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Overrides the form_error_handler service to enable inline form errors.
 */
class InlineFormErrorsServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $container->getDefinition('form_error_handler')
      ->setClass(FormErrorHandler::class)
      ->setArguments([
        new Reference('string_translation'),
        new Reference('link_generator'),
        new Reference('renderer'),
        new Reference('messenger'),
      ]);
  }

}