Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / hacked / src / Controller / HackedDiffController.php.rej
diff --git a/web/modules/contrib/hacked/src/Controller/HackedDiffController.php.rej b/web/modules/contrib/hacked/src/Controller/HackedDiffController.php.rej
new file mode 100644 (file)
index 0000000..fece960
--- /dev/null
@@ -0,0 +1,65 @@
+--- src/Controller/HackedDiffController.php
++++ src/Controller/HackedDiffController.php
+@@ -2,14 +2,46 @@
+ namespace Drupal\hacked\Controller;
+-use Drupal\diff\EntityComparisonBase;
++use Drupal\Core\Controller\ControllerBase;
++use Drupal\diff\DiffEntityComparison;
+ use Drupal\hacked\hackedFileHasher;
+ use Drupal\hacked\hackedProject;
++use Symfony\Component\DependencyInjection\ContainerInterface;
+ /**
+  * Controller routines for hacked routes.
+  */
+-class HackedDiffController extends EntityComparisonBase {
++class HackedDiffController extends ControllerBase {
++
++  /**
++   * Wrapper object for writing/reading configuration from diff.plugins.yml
++   */
++  protected $config;
++
++  /**
++   * The diff entity comparison service.
++   */
++  protected $entityComparison;
++
++  /**
++   * Constructs a HackedDiffController object.
++   *
++   * @param DiffEntityComparison $entity_comparison
++   *   DiffEntityComparison service.
++   */
++  public function __construct(DiffEntityComparison $entity_comparison) {
++    $this->config = $this->config('diff.settings');
++    $this->entityComparison = $entity_comparison;
++  }
++
++  /**
++   * {@inheritdoc}
++   */
++  public static function create(ContainerInterface $container) {
++    return new static(
++      $container->get('diff.entity_comparison')
++    );
++  }
+   /**
+    * Shows a diff report for a specific file in a project.
+@@ -50,7 +82,7 @@ class HackedDiffController extends EntityComparisonBase {
+       $build = [
+         '#theme'    => 'table',
+         '#header'   => [t('Original'), '', t('Current'), ''],
+-        '#rows'     => $this->getRows($hasher->fetch_lines($original_file), $hasher->fetch_lines($installed_file), TRUE),
++        '#rows'     => $this->entityComparison->getRows($hasher->fetch_lines($original_file), $hasher->fetch_lines($installed_file), TRUE),
+       ];
+       // Add the CSS for the diff.
+@@ -86,4 +118,4 @@ class HackedDiffController extends EntityComparisonBase {
+     ]);
+   }
+-}+}