Skip to content
Snippets Groups Projects
Commit 32328453 authored by Project Update Bot's avatar Project Update Bot Committed by Liam Morland
Browse files

Issue #3297233 by Project Update Bot: Automated Drupal 10 compatibility fixes

parent b3aa68ce
No related branches found
No related tags found
No related merge requests found
Showing
with 18 additions and 18 deletions
......@@ -28,7 +28,7 @@ class FillPdf {
if (empty($pdftk_path)) {
$pdftk_path = 'pdftk';
}
$process = new Process($pdftk_path . ' --version');
$process = new Process([$pdftk_path, '--version']);
$process->run();
// Check there's no error code and the --version output includes "pdftk".
......
......@@ -98,7 +98,7 @@ class OutputHandler implements OutputHandlerInterface {
}
else {
// Full steam ahead!
$saved_file = file_save_data($configuration['data'], "{$resolved_destination_path}/{$configuration['filename']}", FileSystemInterface::EXISTS_RENAME);
$saved_file = \Drupal::service('file.repository')->writeData($configuration['data'], "{$resolved_destination_path}/{$configuration['filename']}", FileSystemInterface::EXISTS_RENAME);
$this->rememberFileContext($saved_file, $configuration['context']);
}
......
......@@ -31,7 +31,7 @@ class FillPdfRedirectAction extends FillPdfSaveAction {
*/
public function execute() {
$saved_file = $this->savePdf();
$url = ($saved_file !== FALSE) ? file_create_url($saved_file->getFileUri()) : Url::fromRoute('<front>')->toString();
$url = ($saved_file !== FALSE) ? \Drupal::service('file_url_generator')->generateAbsoluteString($saved_file->getFileUri()) : Url::fromRoute('<front>')->toString();
return new RedirectResponse($url);
}
......
......@@ -93,7 +93,7 @@ class PdftkPdfBackend extends PdfBackendBase implements ContainerFactoryPluginIn
* {@inheritdoc}
*/
public function parseStream($pdf_content) {
$template_file = file_save_data($pdf_content);
$template_file = \Drupal::service('file.repository')->writeData($pdf_content);
return $this->parseFile($template_file);
}
......@@ -166,7 +166,7 @@ class PdftkPdfBackend extends PdfBackendBase implements ContainerFactoryPluginIn
* {@inheritdoc}
*/
public function mergeStream($pdf_content, array $field_mappings, array $context) {
$template_file = file_save_data($pdf_content);
$template_file = \Drupal::service('file.repository')->writeData($pdf_content);
return $this->mergeFile($template_file, $field_mappings, $context);
}
......@@ -186,7 +186,7 @@ class PdftkPdfBackend extends PdfBackendBase implements ContainerFactoryPluginIn
$xfdf_name = $template_uri . '.xfdf';
$xfdf = create_xfdf(basename($xfdf_name), $fields);
// Generate the file.
$xfdf_file = file_save_data($xfdf, $xfdf_name, FileSystemInterface::EXISTS_RENAME);
$xfdf_file = \Drupal::service('file.repository')->writeData($xfdf, $xfdf_name, FileSystemInterface::EXISTS_RENAME);
// @todo Improve this approach when we turn $context into a value object.
if (!isset($context['fid'])) {
......
......@@ -87,7 +87,7 @@ class TestPdfBackend extends PdfBackendBase implements ContainerFactoryPluginInt
*/
public function mergeStream($pdf_content, array $field_mappings, array $context) {
// Not really populated, but that isn't our job.
$populated_pdf = file_get_contents(drupal_get_path('module', 'fillpdf_test') . '/files/fillpdf_test_v3.pdf');
$populated_pdf = file_get_contents(\Drupal::service('extension.list.module')->getPath('fillpdf_test') . '/files/fillpdf_test_v3.pdf');
$this->state->set('fillpdf_test.last_populated_metadata', [
'field_mapping' => $field_mappings,
......
......@@ -19,7 +19,7 @@ class FillPdfFormDeleteFormTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
static public $modules = ['fillpdf_test'];
protected static $modules = ['fillpdf_test'];
/**
* {@inheritdoc}
......
......@@ -19,7 +19,7 @@ class FillPdfFormDuplicateFormTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
static public $modules = ['fillpdf_test'];
protected static $modules = ['fillpdf_test'];
/**
* {@inheritdoc}
......
......@@ -17,7 +17,7 @@ class FillPdfFormImportFormTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
static public $modules = ['fillpdf_test'];
protected static $modules = ['fillpdf_test'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@ class FillPdfSettingsFormTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['fillpdf_test', 'file_test'];
protected static $modules = ['fillpdf_test', 'file_test'];
use TestFillPdfTrait;
......
......@@ -33,7 +33,7 @@ abstract class FillPdfTestBase extends FileFieldTestBase {
*
* @see \Drupal\Tests\BrowserTestBase::installDrupal()
*/
public static $modules = ['image', 'fillpdf_test'];
protected static $modules = ['image', 'fillpdf_test'];
/**
* The FillPDF link manipulator service.
......
......@@ -20,7 +20,7 @@ class LinkManipulatorTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
static public $modules = ['fillpdf_test'];
protected static $modules = ['fillpdf_test'];
/**
* {@inheritdoc}
......
......@@ -28,7 +28,7 @@ class PdfPopulationTest extends FillPdfTestBase {
*
* @see \Drupal\Tests\BrowserTestBase::installDrupal()
*/
public static $modules = ['filter', 'taxonomy'];
protected static $modules = ['filter', 'taxonomy'];
/**
* A test vocabulary.
......
......@@ -30,7 +30,7 @@ class PdfWebformPopulationTest extends FillPdfTestBase {
*
* @see \Drupal\Tests\BrowserTestBase::installDrupal()
*/
public static $modules = ['webform', 'fillpdf_webform_test'];
protected static $modules = ['webform', 'fillpdf_webform_test'];
/**
* A test webform submission.
......
......@@ -18,7 +18,7 @@ class UninstallTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
static public $modules = ['fillpdf_test'];
protected static $modules = ['fillpdf_test'];
/**
* {@inheritdoc}
......
......@@ -14,7 +14,7 @@ abstract class FillPdfKernelTestBase extends EntityKernelTestBase {
*
* @var array
*/
public static $modules = [
protected static $modules = [
'file',
'link',
'token',
......
......@@ -148,7 +148,7 @@ trait TestFillPdfTrait {
protected function getTestPdfPath($filename) {
/** @var \Drupal\Core\File\FileSystem $file_system */
$file_system = $this->container->get('file_system');
return $file_system->realpath(drupal_get_path('module', 'fillpdf') . '/tests/modules/fillpdf_test/files/' . $filename);
return $file_system->realpath(\Drupal::service('extension.list.module')->getPath('fillpdf') . '/tests/modules/fillpdf_test/files/' . $filename);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment