You are here

class SmartDateServiceProvider in Smart Date 3.0.x

Same name and namespace in other branches
  1. 3.1.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider
  2. 3.2.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider
  3. 3.3.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider
  4. 3.4.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider

Service Provider for Smart Date.

Hierarchy

Expanded class hierarchy of SmartDateServiceProvider

File

src/SmartDateServiceProvider.php, line 13

Namespace

Drupal\smart_date
View source
class SmartDateServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $modules = $container
      ->getParameter('container.modules');
    if (isset($modules['hal'])) {

      // HAL module is enabled, add our Smart Date normalizer.
      // Priority of the normalizer must be higher than other
      // general-purpose typed data and field item normalizers.
      $smart_date = new Definition(SmartDateNormalizer::class);
      $smart_date
        ->addTag('normalizer', [
        'priority' => 30,
      ]);
      $container
        ->setDefinition('smart_date.normalizer.smartdate.hal', $smart_date);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ServiceProviderBase::register public function Registers services to the container. Overrides ServiceProviderInterface::register 1
SmartDateServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceProviderBase::alter