InlineFormErrorsServiceProvider.php

Same filename in other branches
  1. 9 core/modules/inline_form_errors/src/InlineFormErrorsServiceProvider.php
  2. 10 core/modules/inline_form_errors/src/InlineFormErrorsServiceProvider.php
  3. 11.x core/modules/inline_form_errors/src/InlineFormErrorsServiceProvider.php

Namespace

Drupal\inline_form_errors

File

core/modules/inline_form_errors/src/InlineFormErrorsServiceProvider.php

View source
<?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('renderer'),
            new Reference('messenger'),
        ]);
    }

}

Classes

Title Deprecated Summary
InlineFormErrorsServiceProvider Overrides the form_error_handler service to enable inline form errors.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.