You are here

class Http2ServerPushServiceProvider in HTTP/2 Server Push 8

Hierarchy

Expanded class hierarchy of Http2ServerPushServiceProvider

See also

\Drupal\http2_server_push\EventSubscriber\ConfigSubscriber::onSave()

File

src/Http2ServerPushServiceProvider.php, line 12

Namespace

Drupal\http2_server_push
View source
class Http2ServerPushServiceProvider implements ServiceProviderInterface {

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {
    if (!$this
      ->cssAggregationIsEnabled()) {
      $container
        ->removeDefinition('asset.css.collection_renderer.http2_server_push');
    }
    if (!$this
      ->jsAggregationIsEnabled()) {
      $container
        ->removeDefinition('asset.js.collection_renderer.http2_server_push');
    }
  }

  /**
   * @return bool
   */
  protected function cssAggregationIsEnabled() {
    return BootstrapConfigStorageFactory::get()
      ->read('system.performance')['css']['preprocess'] === TRUE;
  }

  /**
   * @return bool
   */
  protected function jsAggregationIsEnabled() {
    return BootstrapConfigStorageFactory::get()
      ->read('system.performance')['js']['preprocess'] === TRUE;
  }

}

Members