Commit 2d518f93 authored by Gaus Surahman's avatar Gaus Surahman Committed by Gaus Surahman
Browse files

Issue #3263027 by gausarts, kobusvw, mably, bogdog400: Incompatible with...

Issue #3263027 by gausarts, kobusvw, mably, bogdog400: Incompatible with Drupal 8, release 2.6 - app.root error
parent bf8e998e
Loading
Loading
Loading
Loading
+5 −0
Changes for CHANGELOG.txt: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line

Blazy 8.x-2.0-dev, 2022-02-09
-----------------------------
Issue #3263027 by gausarts, kobusvw, mably, bogdog400: Incompatible with Drupal
  8, release 2.6 - app.root error.

Blazy 8.x-2.0-dev, 2022-02-08
-----------------------------
- Fixed for NativeGrid Masonry with AJAX loaded contents like IO infinite pager.
+7 −0
Changes for blazy.post_update.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -124,3 +124,10 @@ function blazy_post_update_remove_io_enabled_key() {
  $config->clear('io.enabled');
  $config->save(TRUE);
}

/**
 * Fixed for D8 to D10+ cross-compat `app.root`.
 */
function blazy_post_update_app_root() {
  // Empty hook to clear caches.
}
+1 −2
Changes for blazy.services.yml: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -2,11 +2,10 @@ services:
  blazy.manager.base:
    abstract: true
    class: Drupal\blazy\BlazyManagerBase
    arguments: ['@entity.repository', '@entity_type.manager', '@module_handler', '@renderer', '@config.factory', '@cache.default']
    arguments: ['%app.root%', '@entity.repository', '@entity_type.manager', '@module_handler', '@renderer', '@config.factory', '@cache.default']
    calls:
      # @todo remove and use DI instead after sub-module updates, and put as the
      # last argument only if to support careless users ignoring hook_update().
      - [setRoot, ['%app.root%']]
      - [setLanguageManager, ['@language_manager']]

  blazy.manager:
+7 −0
Changes for src/Blazy.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -496,6 +496,13 @@ class Blazy implements BlazyInterface {
    BlazyAlter::configSchemaInfoAlter($definitions, $formatter, $settings);
  }

  /**
   * Returns the cross-compat D8 ~ D10 app root.
   */
  public static function root($container) {
    return version_compare(\Drupal::VERSION, '9.0', '<') ? $container->get('app.root') : $container->getParameter('app.root');
  }

  /**
   * Returns a wrapper to pass tests, or DI where adding params is troublesome.
   */
+3 −12
Changes for src/BlazyManagerBase.php: 3 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ abstract class BlazyManagerBase implements BlazyManagerInterface {
  /**
   * Constructs a BlazyManager object.
   */
  public function __construct(EntityRepositoryInterface $entity_repository, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, ConfigFactoryInterface $config_factory, CacheBackendInterface $cache) {
  public function __construct($root, EntityRepositoryInterface $entity_repository, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, ConfigFactoryInterface $config_factory, CacheBackendInterface $cache) {
    $this->root              = $root;
    $this->entityRepository  = $entity_repository;
    $this->entityTypeManager = $entity_type_manager;
    $this->moduleHandler     = $module_handler;
@@ -98,6 +99,7 @@ abstract class BlazyManagerBase implements BlazyManagerInterface {
   */
  public static function create(ContainerInterface $container) {
    $instance = new static(
      Blazy::root($container),
      $container->get('entity.repository'),
      $container->get('entity_type.manager'),
      $container->get('module_handler'),
@@ -107,7 +109,6 @@ abstract class BlazyManagerBase implements BlazyManagerInterface {
    );

    // @todo remove and use DI at 2.x+ post sub-classes updates.
    $instance->setRoot($container->getParameter('app.root'));
    $instance->setLanguageManager($container->get('language_manager'));
    return $instance;
  }
@@ -119,16 +120,6 @@ abstract class BlazyManagerBase implements BlazyManagerInterface {
    return $this->root;
  }

  /**
   * Sets app root service.
   *
   * @todo remove and use DI at 3.x+ post sub-classes updates.
   */
  public function setRoot($root) {
    $this->root = (string) $root;
    return $this;
  }

  /**
   * Returns the language manager service.
   */
Loading