Browse Source

Undo overzealous Rector.

pull/943/head
Rosie Le Faive 2 years ago
parent
commit
879dc2091d
  1. 1
      .github/workflows/build-2.x.yml
  2. 1
      modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml
  3. 1
      modules/islandora_core_feature/config/install/views.view.file_checksum.yml
  4. 1
      modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml
  5. 34
      modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
  6. 18
      modules/islandora_text_extraction/src/Controller/MediaSourceController.php
  7. 7
      src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
  8. 1
      tests/src/Functional/JsonldSelfReferenceReactionTest.php
  9. 1
      tests/src/Functional/JsonldTypeAlterReactionTest.php

1
.github/workflows/build-2.x.yml

@ -123,4 +123,3 @@ jobs:
run: |
cd $DRUPAL_DIR/web/core
$DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"

1
modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml

@ -168,4 +168,3 @@ display:
- url.query_args
- user.permissions
tags: { }

1
modules/islandora_core_feature/config/install/views.view.file_checksum.yml

@ -304,4 +304,3 @@ display:
- url
- user.permissions
tags: { }

1
modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml

@ -194,4 +194,3 @@ display:
- url.query_args
- user.permissions
tags: { }

34
modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

@ -4,6 +4,7 @@ namespace Drupal\islandora_iiif\Plugin\views\style;
use Drupal\views\Plugin\views\style\StylePluginBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Url;
@ -91,10 +92,17 @@ class IIIFManifest extends StylePluginBase {
*/
protected $messenger;
/**
* Module Handler for running hooks.
*
* @var \Drupal\Core\Extention\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, ModuleHandlerInterface $moduleHandler) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->serializer = $serializer;
@ -104,6 +112,7 @@ class IIIFManifest extends StylePluginBase {
$this->fileSystem = $file_system;
$this->httpClient = $http_client;
$this->messenger = $messenger;
$this->moduleHandler = $moduleHandler;
}
/**
@ -120,10 +129,21 @@ class IIIFManifest extends StylePluginBase {
$container->get('entity_type.manager'),
$container->get('file_system'),
$container->get('http_client'),
$container->get('messenger')
$container->get('messenger'),
$container->get('module_handler')
);
}
/**
* Return the request property.
*
* @return \Symfony\Component\HttpFoundation\Request
* The Symfony request object
*/
public function getRequest() {
return $this->request;
}
/**
* {@inheritdoc}
*/
@ -170,6 +190,9 @@ class IIIFManifest extends StylePluginBase {
$content_type = 'json';
// Give other modules a chance to alter the manifest.
$this->moduleHandler->alter('islandora_iiif_manifest', $json, $this);
return $this->serializer->serialize($json, $content_type, ['views_style_plugin' => $this]);
}
@ -288,6 +311,13 @@ class IIIFManifest extends StylePluginBase {
];
}
// Give other modules a chance to alter the canvas.
$alter_options = [
'options' => $this->options,
'views_plugin' => $this,
];
$this->moduleHandler->alter('islandora_iiif_manifest_canvas', $tmp_canvas, $row, $alter_options);
$canvases[] = $tmp_canvas;
}
}

18
modules/islandora_text_extraction/src/Controller/MediaSourceController.php

@ -5,6 +5,7 @@ namespace Drupal\islandora_text_extraction\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\File\FileSystem;
use Drupal\Core\File\FileSystemInterface;
use Drupal\file\FileRepository;
use Drupal\media\Entity\Media;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
@ -42,14 +43,24 @@ class MediaSourceController extends ControllerBase {
*/
protected $fileSystem;
/**
* File repository service.
*
* @var \Drupal\file\FileRepository
*/
protected $fileRepository;
/**
* MediaSourceController constructor.
*
* @param \Drupal\Core\File\FileSystem $fileSystem
* Filesystem service.
* @param \Drupal\file\FileRepository $fileRepository
* File Repository service.
*/
public function __construct(FileSystem $fileSystem) {
public function __construct(FileSystem $fileSystem, FileRepository $fileRepository) {
$this->fileSystem = $fileSystem;
$this->fileRepository = $fileRepository;
}
/**
@ -63,7 +74,8 @@ class MediaSourceController extends ControllerBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('file_system')
$container->get('file_system'),
$container->get('file.repository'),
);
}
@ -98,7 +110,7 @@ class MediaSourceController extends ControllerBase {
if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable");
}
$file = \Drupal::service('file.repository')->writeData($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
$file = $this->fileRepository->writeData($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
if ($media->hasField($destination_field)) {
$media->{$destination_field}->setValue([
'target_id' => $file->id(),

7
src/Form/AddChildrenWizard/AbstractFileSelectionForm.php

@ -37,11 +37,6 @@ abstract class AbstractFileSelectionForm extends FormBase {
* @var \Drupal\islandora\Form\AddChildrenWizard\AbstractBatchProcessor|null
*/
protected ?AbstractBatchProcessor $batchProcessor;
private \static $static;
public function __construct(\static $static)
{
$this->static = $static;
}
/**
* {@inheritdoc}
@ -54,7 +49,7 @@ abstract class AbstractFileSelectionForm extends FormBase {
$instance->entityFieldManager = $container->get('entity_field.manager');
$instance->currentUser = $container->get('current_user');
$instance->batchProcessor = $this->static;
$instance->batchProcessor = $container->get(static::BATCH_PROCESSOR);
return $instance;
}

1
tests/src/Functional/JsonldSelfReferenceReactionTest.php

@ -3,6 +3,7 @@
namespace Drupal\Tests\islandora\Functional;
use function GuzzleHttp\json_decode;
/**
* Class MappingUriPredicateReactionTest.
*

1
tests/src/Functional/JsonldTypeAlterReactionTest.php

@ -3,6 +3,7 @@
namespace Drupal\Tests\islandora\Functional;
use function GuzzleHttp\json_decode;
/**
* Tests Jsonld Alter Reaction.
*

Loading…
Cancel
Save