Skip to content
Snippets Groups Projects
Commit 437dc9a4 authored by Liam Morland's avatar Liam Morland
Browse files

Issue #3272489: Remove deprecated interface FillPdfBackendPluginInterface

parent 1bcb8d45
No related branches found
No related tags found
No related merge requests found
<?php
namespace Drupal\fillpdf;
/**
* Defines the required interface for all FillPDF BackendService plugins.
*
* @package Drupal\fillpdf
*
* @deprecated in fillpdf:8.x-4.9 and is removed from fillpdf:8.x-5.0.
* Instead of implementing FillPdfBackendPluginInterface, you should extend
* PdfBackendBase.
* @see https://www.drupal.org/node/3059476
* @see \Drupal\fillpdf\Plugin\PdfBackendBase
*/
interface FillPdfBackendPluginInterface {
/**
* Parse a PDF and return a list of its fields.
*
* @param \Drupal\fillpdf\FillPdfFormInterface $fillpdf_form
* The PDF whose fields are going to be parsed.
*
* @return array
* An array of associative arrays. Each sub-array contains a 'name' key with
* the name of the field and a 'type' key with the type. These can be
* iterated over and saved by the caller.
*/
public function parse(FillPdfFormInterface $fillpdf_form);
/**
* Populate a FillPDF form with field data.
*
* Formerly known as merging. Accept an array of PDF field keys and field
* values and populate the PDF using them.
*
* @param \Drupal\fillpdf\FillPdfFormInterface $fillpdf_form
* The FillPdfForm referencing the file whose field values are going to be
* populated.
* @param array $field_mapping
* An array of fields mapping PDF field keys to the values with which they
* should be replaced. Example array:
* @code
* [
* 'values' => [
* 'Field 1' => 'value',
* 'Checkbox Field' => 'On',
* ],
* 'images' => [
* 'Image Field 1' => [
* 'data' => base64_encode($file_data),
* 'filenamehash' => md5($image_path_info['filename']) . '.' . $image_path_info['extension'],
* ],
* ],
* ]
* @endcode
* @param array $context
* The request context as returned by
* FillPdfLinkManipulatorInterface::parseLink().
*
* @return string|null
* The raw file contents of the new PDF, or NULL if populating failed. The
* caller has to handle saving or serving the file accordingly.
*/
public function populateWithFieldData(FillPdfFormInterface $fillpdf_form, array $field_mapping, array $context);
}
...@@ -104,7 +104,7 @@ class BackendProxy implements BackendProxyInterface { ...@@ -104,7 +104,7 @@ class BackendProxy implements BackendProxyInterface {
} }
// Now load the backend plugin. // Now load the backend plugin.
/** @var \Drupal\fillpdf\FillPdfBackendPluginInterface|\Drupal\fillpdf\Plugin\PdfBackendInterface $backend */ /** @var \Drupal\fillpdf\Plugin\PdfBackendInterface $backend */
$backend = $this->backendManager->createInstance($config->get('backend'), $config->get()); $backend = $this->backendManager->createInstance($config->get('backend'), $config->get());
// @todo Emit event (or call alter hook?) before populating PDF. // @todo Emit event (or call alter hook?) before populating PDF.
......
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