diff --git a/fillpdf.info b/fillpdf.info deleted file mode 100644 index e7c132cc5c9e1b40ab1814d4d8f12623a3795087..0000000000000000000000000000000000000000 --- a/fillpdf.info +++ /dev/null @@ -1,6 +0,0 @@ -name = FillPDF -description = Allows users to populate PDF forms from submitted node data. -package = Other -core = 7.x - -dependencies[] = token diff --git a/fillpdf.install b/fillpdf.install index ae8508c6ab3b961b41ad868079de23865d6dc649..ffbf84ef8ee39557d9519064d6c3f1b77bf508a2 100644 --- a/fillpdf.install +++ b/fillpdf.install @@ -1,4 +1,9 @@ <?php +/** + * @file + * Install functions for FillPDF. + */ + use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\fillpdf\Service\FillPdfAdminFormHelper; diff --git a/fillpdf.module b/fillpdf.module index 56c9b217450ee8d13dfb6b843f658fa22a434b26..8a17362de569a680635b1fb1e893020e31905e7c 100644 --- a/fillpdf.module +++ b/fillpdf.module @@ -2,7 +2,7 @@ /** * @file - * Allows mappings of PDFs to site content + * Allows mappings of PDFs to site content. */ /** @@ -11,17 +11,15 @@ function fillpdf_help($path, $arg) { switch ($path) { case 'admin/help#fillpdf': - $content = t('See the <a href="!documentation">documentation on drupal.org</a> for a full description of and guide to this module.', array('!documentation' => \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))); + $content = t('See the <a href="!documentation">documentation on drupal.org</a> for a full description of and guide to this module.', ['!documentation' => \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf')]); return $content; - break; case 'admin/structure/fillpdf': if (\Drupal::moduleHandler()->moduleExists('help')) { return t('See the !link for an explanation on dowloading these forms to PDF', - array('!link' => \Drupal::l(t('documentation'), \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf')))); + ['!link' => \Drupal::l(t('documentation'), \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))]); } else { - return t('Activate the help module if you need an ' . - 'explanation on downloading these forms to PDF.'); + return t('Activate the help module if you need an explanation on downloading these forms to PDF.'); } break; } diff --git a/fillpdf.rules.inc b/fillpdf.rules.inc deleted file mode 100644 index 60291e1735a23b380f4e5c6f8e05361374ff7ad2..0000000000000000000000000000000000000000 --- a/fillpdf.rules.inc +++ /dev/null @@ -1,222 +0,0 @@ -<?php -/** - * @file fillpdf.rules.inc - * - * Come on, you know what this is for! It's in the name! - * (But if you don't - it's for Rules integration.) - */ - -/** - * ************* - * *Rules hooks* - * ************* - */ - - -/** - * Implements hook_rules_data_info(). - * @todo: Define the fillpdf data structure. - * See http://drupal.org/node/905632 - */ -function fillpdf_rules_data_info() { - return array( - 'fillpdf' => array( - 'label' => t('FillPDF metadata'), - 'group' => t('FillPDF'), - 'property info' => _fillpdf_rules_metadata_info(), - ), - ); -} - -/** - * Implements hook_rules_event_info(). - * @todo: Define the "FillPDF has filled the PDF" event - * @todo: Define the following events: - * - FillPDF is about to prepare PDF-filling data (fillpdf_merge_pre_merge) - * - FillPDF is ready to fill the PDF (fillpdf_merge_fields_alter) - */ -function fillpdf_rules_event_info() { - $defaults = array( - 'group' => t('FillPDF'), - 'module' => 'fillpdf', - ); - return array( - 'fillpdf_merge_pre_handle' => $defaults + array( - 'label' => t('Filled PDF is about to be handled'), - 'variables' => array( - 'fillpdf' => array('type' => 'fillpdf', 'label' => 'FillPDF metadata'), - ), - ) - );; -} - -/** - * Implements hook_rules_action_info(). - * @todo: Define the following actions: - * - Fill a PDF with data from content - * - Fill a PDF with data from Webform submissions - * - Send PDF to user's browser - * - Generate a FillPDF link (saves new variable - could be useful for e-mail - * templates and such) - */ -function fillpdf_rules_action_info() { - $defaults = array( - 'group' => t('FillPDF'), - ); - return array( - 'fillpdf_load' => $defaults + array( - 'label' => t('Load a FillPDF configuration'), - 'base' => 'fillpdf_rules_action_load_fillpdf', - 'provides' => array( - 'fillpdf' => array( - 'type' => 'fillpdf', - 'label' => t('FillPDF metadata'), - ), - ), - 'parameter' => array( - 'fid' => array( - 'type' => 'integer', - 'label' => t('FillPDF Form ID'), - ) - ), - ), - 'fillpdf_merge_webform' => $defaults + array( - 'label' => t('Fill a PDF with webform data'), - 'base' => 'fillpdf_rules_action_merge_webform', - 'description' => t('Populates the PDF with webform data and updates the - Rules variable with all information necessary to handle it.'), - 'parameter' => array( - 'fillpdf' => array( - 'type' => 'fillpdf', - 'label' => t('FillPDF metadata'), - ), - 'webform_nid' => array( - 'type' => 'integer', - 'label' => t('Webform Node ID'), - 'optional' => TRUE, - 'description' => t('If you leave this blank, the <em>Default Node ID</em> from the FillPDF configuration will be used.'), - ), - 'webform_sids' => array( - 'type' => 'list<integer>', - 'label' => t('Webform Submission ID(s)'), - 'optional' => TRUE, - 'description' => t('If you leave this blank, the most recent submission will be used. The last ID you specify will be checked first.'), - ), - ), - ), - 'fillpdf_handle_default' => $defaults + array( - 'label' => t('Perform the default action on the PDF'), - 'description' => t('Handle the PDF according to its FillPDF configuration.'), - 'base' => 'fillpdf_rules_action_handle_default', - 'parameter' => array( - 'fillpdf' => array( - 'type' => 'fillpdf', - 'label' => t('FillPDF metadata'), - ) - ), - ), - 'fillpdf_save_to_file' => $defaults + array( - 'label' => t('Save PDF to a file'), - 'base' => 'fillpdf_rules_action_save_to_file', - 'provides' => array( - 'fillpdf_saved_file_path' => array( - 'type' => 'text', - 'label' => t('Path to saved PDF'), - ), - ), - 'parameter' => array( - 'fillpdf' => array( - 'type' => 'fillpdf', - 'label' => t('FillPDF metadata'), - ) - ), - ), - 'fillpdf_delete_saved_file' => $defaults + array( - 'label' => t('Delete saved PDF'), - 'base' => 'fillpdf_rules_action_delete_file', - 'parameter' => array( - 'filename' => array( - 'type' => 'text', - 'label' => t('Filename of PDF to delete'), - ), - ), - ) - ); -} - -/** - * Implements hook_rules_condition_info(). - * @todo: Define the following conditions: - * - A node is being filled - * - A Webform is being filled - */ -function fillpdf_rules_condition_info() { - -} - -/** - * ***************** - * *Rules callbacks* - * ***************** - */ - -// Action callbacks // - -function fillpdf_rules_action_load_fillpdf($fid) { - $fillpdf = new stdClass; - $fillpdf->info = fillpdf_load($fid); - return array( - 'fillpdf' => $fillpdf, - ); -} - -/** - * Populates a loaded FillPDF configuration's PDF with data. - */ -function fillpdf_rules_action_merge_webform($fillpdf, $webform_nid = '', $webform_sids = array()) { - $skip_access_check = FALSE; - $flatten = TRUE; - $webforms = array(); - foreach ($webform_sids as $sid) { - $webforms[] = array('nid' => $webform_nid, - 'sid' => $sid, - ); - } - - if (empty($webforms) && empty($webform_nid) !== TRUE) { - $webforms[0]['nid'] = $webform_nid; - } - - // @todo: Parameterize $skip_access_check and $flatten in Rules. - $fillpdf = fillpdf_merge_pdf($fillpdf->info->fid, NULL, $webforms, NULL, FALSE, $skip_access_check, $flatten, FALSE); - return array('fillpdf' => $fillpdf); -} - -/** - * Save the PDF to a file and return the file path. - */ -function fillpdf_rules_action_save_to_file($fillpdf) { - $saved_file_path = fillpdf_save_to_file($fillpdf->info, $fillpdf->data, $fillpdf->token_objects, _fillpdf_process_filename($fillpdf->info->title, $fillpdf->token_objects), FALSE); - return array( - 'fillpdf_saved_file_path' => $saved_file_path, - ); -} - -/** - * Perform the default action on the PDF. This always ends in a drupal_goto() or a drupal_exit(). - */ -function fillpdf_rules_action_handle_default($fillpdf) { - fillpdf_merge_handle_pdf($fillpdf->info, $fillpdf->data, $fillpdf->token_objects, 'default'); -} - -function fillpdf_rules_action_delete_file($filename) { - file_unmanaged_delete($filename); -} - -// Condition callbacks // - -// Metadata callbacks // -function _fillpdf_rules_metadata_info() { - return array(); -} - diff --git a/fillpdf.rules_defaults.inc b/fillpdf.rules_defaults.inc deleted file mode 100644 index 260917b55c330d34a190530fc267cb7d529123ca..0000000000000000000000000000000000000000 --- a/fillpdf.rules_defaults.inc +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Implements hook_default_rules_configuration(). - */ -function fillpdf_default_rules_configuration() { - $default_rules = array(); - // Attach the filled PDF to an e-mail. - if (\Drupal::moduleHandler()->moduleExists('mimemail') && \Drupal::moduleHandler()->moduleExists('webform_rules') && \Drupal::moduleHandler()->moduleExists('webform')) { - $default_rules['rules_webform_fillpdf_attachment'] = rules_import('{ "rules_send_webform_submission_confirmation_with_filled_pdf_as_attachment" : { - "LABEL" : "Send Webform submission confirmation e-mail with filled PDF as attachment", - "PLUGIN" : "reaction rule", - "ACTIVE" : false, - "REQUIRES" : [ "rules", "fillpdf", "mimemail", "webform_rules" ], - "ON" : [ "webform_rules_submit" ], - "IF" : [ { "data_is" : { "data" : [ "node:nid" ], "value" : "2" } } ], - "DO" : [ - { "fillpdf_load" : { - "USING" : { "fid" : "6" }, - "PROVIDE" : { "fillpdf" : { "fillpdf" : "FillPDF metadata" } } - } - }, - { "fillpdf_merge_webform" : { - "fillpdf" : [ "fillpdf" ], - "webform_nid" : "2", - "webform_sids" : { "value" : [] } - } - }, - { "fillpdf_save_to_file" : { - "USING" : { "fillpdf" : [ "fillpdf" ] }, - "PROVIDE" : { "fillpdf_saved_file_path" : { "fillpdf_saved_file_path" : "Path to saved PDF" } } - } - }, - { "mimemail" : { - "to" : [ "site:mail" ], - "subject" : "Copy of completed PDF for your records", - "body" : "Thank you for filling out the form on our website. A copy of your completed PDF is attached.", - "plaintext" : " Thank you for filling out the form on our website. A copy of your completed PDF is attached.", - "attachments" : [ "fillpdf-saved-file-path" ] - } - }, - { "fillpdf_delete_saved_file" : { "filename" : [ "fillpdf-saved-file-path" ] } } - ] - } - }'); - } - return $default_rules; -} - diff --git a/src/Component/Helper/FillPdfMappingHelper.php b/src/Component/Helper/FillPdfMappingHelper.php index d8ce69b80a541bbb37f359ba3a8a53f6d16c2d68..c5f24e7cf1a0e18aecf038d9d6ed92652bc764a7 100644 --- a/src/Component/Helper/FillPdfMappingHelper.php +++ b/src/Component/Helper/FillPdfMappingHelper.php @@ -1,18 +1,26 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelper. - */ + * @file + * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelper. + */ namespace Drupal\fillpdf\Component\Helper; +/** + * Class FillPdfMappingHelper. + * + * @package Drupal\fillpdf\Component\Helper + */ class FillPdfMappingHelper { public static function parseReplacements($replacements_string) { if (empty($replacements_string) !== TRUE) { - $standardized_replacements = str_replace(array("\r\n", "\r"), "\n", $replacements_string); + $standardized_replacements = str_replace([ + "\r\n", + "\r", + ], "\n", $replacements_string); $lines = explode("\n", $standardized_replacements); - $return = array(); + $return = []; foreach ($lines as $replacement) { if (!empty($replacement)) { $split = explode('|', $replacement); @@ -25,7 +33,7 @@ class FillPdfMappingHelper { return $return; } else { - return array(); + return []; } } diff --git a/src/Component/Helper/FillPdfMappingHelperInterface.php b/src/Component/Helper/FillPdfMappingHelperInterface.php index be420b1fc9a8d81308be912c6ff2b12eaedafac5..e31fe0fd1e7dab6b0032d6f28576447c928cc8ca 100644 --- a/src/Component/Helper/FillPdfMappingHelperInterface.php +++ b/src/Component/Helper/FillPdfMappingHelperInterface.php @@ -1,11 +1,16 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelperInterface. - */ + * @file + * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelperInterface. + */ namespace Drupal\fillpdf\Component\Helper; +/** + * Interface FillPdfMappingHelperInterface. + * + * @package Drupal\fillpdf\Component\Helper + */ interface FillPdfMappingHelperInterface { } diff --git a/src/Component/Utility/FillPdf.php b/src/Component/Utility/FillPdf.php index 30b26b083619854c98d83eb2a36b92bfcd352f72..17cda6b8ed236acdb3486fdf4d270a097bd065ba 100644 --- a/src/Component/Utility/FillPdf.php +++ b/src/Component/Utility/FillPdf.php @@ -3,10 +3,17 @@ * @file * Contains \Drupal\fillpdf\Component\Utility\FillPdf. */ + namespace Drupal\fillpdf\Component\Utility; + use Drupal\views\Views; use \Symfony\Component\Process\Process; +/** + * Class FillPdf. + * + * @package Drupal\fillpdf\Component\Utility + */ class FillPdf { public static function checkPdftkPath($pdftk_path = '') { diff --git a/src/Entity/FillPdfFileContext.php b/src/Entity/FillPdfFileContext.php index 31427e232cb3fd7d95896c71049915be69ced319..4e5b0db2cdbeee74eda0bb1f996cc1a58a74a001 100644 --- a/src/Entity/FillPdfFileContext.php +++ b/src/Entity/FillPdfFileContext.php @@ -12,10 +12,8 @@ use Drupal\Core\Entity\Annotation\ContentEntityType; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Entity\ContentEntityBase; -use Drupal\Core\Entity\EntityChangedTrait; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\fillpdf\FillPdfFileContextInterface; -use Drupal\user\UserInterface; /** * Defines the FillPDF file context entity. diff --git a/src/FillPdfAccessController.php b/src/FillPdfAccessController.php index 8bbe903d792b938206e647150daad1baade50c9c..5f2b4932d06bc6f47d47ebe3b849c396b6eb91fa 100644 --- a/src/FillPdfAccessController.php +++ b/src/FillPdfAccessController.php @@ -6,9 +6,7 @@ namespace Drupal\fillpdf; -use Drupal\Core\Access\AccessResult; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\EntityInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; use Drupal\Core\Session\AccountInterface; diff --git a/src/FillPdfAccessHelper.php b/src/FillPdfAccessHelper.php index d9d22a508b86dda3af8e1ffa2b408d179ca11893..679032da9f52e447f76fc3181116647ceff315c4 100644 --- a/src/FillPdfAccessHelper.php +++ b/src/FillPdfAccessHelper.php @@ -8,7 +8,6 @@ namespace Drupal\fillpdf; use Drupal\Core\Access\AccessResult; -use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; diff --git a/src/FillPdfAdminFormHelperInterface.php b/src/FillPdfAdminFormHelperInterface.php index 41d241e140cefaf28320bd87744740ed56f524b9..64718a16b60460b3935b916ddd3d08181be7b548 100644 --- a/src/FillPdfAdminFormHelperInterface.php +++ b/src/FillPdfAdminFormHelperInterface.php @@ -1,15 +1,20 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfAdminFormHelperInterface. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfAdminFormHelperInterface. + */ namespace Drupal\fillpdf; +/** + * Interface FillPdfAdminFormHelperInterface + * @package Drupal\fillpdf + */ interface FillPdfAdminFormHelperInterface { /** - * Returns the render array to show a token form with types supported by FillPDF. + * Returns the render array to show a token form with types supported by + * FillPDF. * * @return array */ diff --git a/src/FillPdfBackendManager.php b/src/FillPdfBackendManager.php index 8636c7f57abd4f20748d132da5bdae23cdbfe84d..9b46299034245fc77e28248aea734d0a70873f05 100644 --- a/src/FillPdfBackendManager.php +++ b/src/FillPdfBackendManager.php @@ -1,9 +1,8 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfBackendManager. - */ - + * @file + * Contains \Drupal\fillpdf\FillPdfBackendManager. + */ namespace Drupal\fillpdf; diff --git a/src/FillPdfBackendPluginInterface.php b/src/FillPdfBackendPluginInterface.php index 4329b39d564dabd224a0af12925f70cfea702e15..2539bc836ef8dbd5dfa7e92cf6820be9f318722a 100644 --- a/src/FillPdfBackendPluginInterface.php +++ b/src/FillPdfBackendPluginInterface.php @@ -1,8 +1,8 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfBackendPluginInterface. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfBackendPluginInterface. + */ namespace Drupal\fillpdf; @@ -35,7 +35,7 @@ interface FillPdfBackendPluginInterface { * @param array $field_mapping An array of fields mapping PDF field keys to the * values with which they should be replaced. Example array: * - * @code + * @code * array( * 'values' => array( * 'Field 1' => 'value', @@ -48,7 +48,7 @@ interface FillPdfBackendPluginInterface { * ), * ), * ) - * @endcode + * @endcode * @param array $context @todo: Define * @return string The raw file contents of the new PDF; the caller has to * handle saving or serving the file accordingly. diff --git a/src/FillPdfContextManagerInterface.php b/src/FillPdfContextManagerInterface.php index 578c38042f683eefb76da373575203873035d36f..e2c432f49303a83c790aeb41a3e0d7fbb2eb316e 100644 --- a/src/FillPdfContextManagerInterface.php +++ b/src/FillPdfContextManagerInterface.php @@ -1,12 +1,14 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfContextManagerInterface\FillPdfContextManagerInterface. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfContextManagerInterface\FillPdfContextManagerInterface. + */ namespace Drupal\fillpdf; /** + * Load entities from a FillPDF $context. + * * Provides a common interface for loading and serialization of the $context * array returned by FillPdfLinkManipulator::parseRequest(). * diff --git a/src/FillPdfFileContextInterface.php b/src/FillPdfFileContextInterface.php index 3de5d34c11a5af381e79612b725a2f03d76148df..847c1de2649a013b35f706cab0267c5e718790cd 100644 --- a/src/FillPdfFileContextInterface.php +++ b/src/FillPdfFileContextInterface.php @@ -8,9 +8,6 @@ namespace Drupal\fillpdf; use Drupal\Core\Entity\ContentEntityInterface; -use Drupal\Core\Entity\EntityChangedInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\user\EntityOwnerInterface; /** * Provides an interface for defining FillPDF file context entities. diff --git a/src/FillPdfFormAccessControlHandler.php b/src/FillPdfFormAccessControlHandler.php index d9c671012ce921ec2ca415eb28bcfdb2acba7dbf..3bc0c3165dc5ea80b9f8618e584fee57474b15f6 100644 --- a/src/FillPdfFormAccessControlHandler.php +++ b/src/FillPdfFormAccessControlHandler.php @@ -8,12 +8,9 @@ namespace Drupal\fillpdf; use Drupal\Core\Entity\EntityAccessControlHandler; -use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Access\AccessResult; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Access controller for the FillPDF form entity. @@ -31,10 +28,8 @@ class FillPdfFormAccessControlHandler extends EntityAccessControlHandler { case 'update': case 'delete': return AccessResult::allowedIfHasPermission($account, 'administer pdfs'); - break; default: return AccessResult::neutral(); - break; } } diff --git a/src/FillPdfFormFieldInterface.php b/src/FillPdfFormFieldInterface.php index d766fe0c1fa804a720ba3f18e7cabc9a659d5b4d..483c33926a4bbca0b046d0990dfc699c8c016fc4 100644 --- a/src/FillPdfFormFieldInterface.php +++ b/src/FillPdfFormFieldInterface.php @@ -1,13 +1,18 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfFormFieldInterface. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfFormFieldInterface. + */ namespace Drupal\fillpdf; use Drupal\Core\Entity\ContentEntityInterface; +/** + * Interface FillPdfFormFieldInterface. + * + * @package Drupal\fillpdf + */ interface FillPdfFormFieldInterface extends ContentEntityInterface { } diff --git a/src/FillPdfFormFieldViewsData.php b/src/FillPdfFormFieldViewsData.php index 352b0e8b5c4829ba58cb83315e39a90017a27949..8634e44b29560679ecc2cfacb560af463470dbf5 100644 --- a/src/FillPdfFormFieldViewsData.php +++ b/src/FillPdfFormFieldViewsData.php @@ -1,13 +1,18 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfFormFieldViewsData. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfFormFieldViewsData. + */ namespace Drupal\fillpdf; use Drupal\views\EntityViewsData; +/** + * Class FillPdfFormFieldViewsData. + * + * @package Drupal\fillpdf + */ class FillPdfFormFieldViewsData extends EntityViewsData { /** diff --git a/src/FillPdfFormInterface.php b/src/FillPdfFormInterface.php index 69451121f9d986e5d6dc4e89dc5c456f70ba7b2d..f33f629322d8824ab35980fa2271f9d41fe9b642 100644 --- a/src/FillPdfFormInterface.php +++ b/src/FillPdfFormInterface.php @@ -1,16 +1,17 @@ <?php /** - * @file - * Contains Drupal\fillpdf\FillPdfFormInterface. - */ + * @file + * Contains Drupal\fillpdf\FillPdfFormInterface. + */ namespace Drupal\fillpdf; use Drupal\Core\Entity\ContentEntityInterface; -use Drupal\user\EntityOwnerInterface; +/** + * Interface FillPdfFormInterface. + * @package Drupal\fillpdf + */ interface FillPdfFormInterface extends ContentEntityInterface { - // @todo: Add functions that must be implemented to interface once I know what they are. - } \ No newline at end of file diff --git a/src/FillPdfFormViewsData.php b/src/FillPdfFormViewsData.php index f1af79cd21f9ba24cb4f7ca0a425fffe64d5e934..e9b494159501f069ed7a2cbd2c2cedbc01f2f3a3 100644 --- a/src/FillPdfFormViewsData.php +++ b/src/FillPdfFormViewsData.php @@ -1,13 +1,18 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfFormViewsData. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfFormViewsData. + */ namespace Drupal\fillpdf; use Drupal\views\EntityViewsData; +/** + * Class FillPdfFormViewsData. + * + * @package Drupal\fillpdf + */ class FillPdfFormViewsData extends EntityViewsData { /** diff --git a/src/FillPdfLinkManipulatorInterface.php b/src/FillPdfLinkManipulatorInterface.php index eff975e4d88fe447a0b5130a3d09eaddfcf152f8..9dbd0e31972be89e29f9adc137690a4af16d5d63 100644 --- a/src/FillPdfLinkManipulatorInterface.php +++ b/src/FillPdfLinkManipulatorInterface.php @@ -1,10 +1,11 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\FillPdfLinkManipulatorInterface. - */ + * @file + * Contains \Drupal\fillpdf\FillPdfLinkManipulatorInterface. + */ namespace Drupal\fillpdf; + use Drupal\Core\Url; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Form/FillPdfAdminFormBase.php b/src/Form/FillPdfAdminFormBase.php index 0e04bc559dfffa248511e96f234ea2320f2b48cc..9fd843bb7fe381f65a05f0d651fd05372c4fb260 100644 --- a/src/Form/FillPdfAdminFormBase.php +++ b/src/Form/FillPdfAdminFormBase.php @@ -6,9 +6,12 @@ namespace Drupal\fillpdf\Form; use Drupal\Core\Form\FormBase; -use Drupal\Core\Form\FormStateInterface; -use Symfony\Component\HttpFoundation\File\UploadedFile; +/** + * Class FillPdfAdminFormBase. + * + * @package Drupal\fillpdf\Form + */ abstract class FillPdfAdminFormBase extends FormBase { public $REPLACEMENTS_DESCRIPTION; diff --git a/src/Form/FillPdfFormExportForm.php b/src/Form/FillPdfFormExportForm.php index 13221d6b09ed35e8e7f569e2dbc1c19bc058bd64..3508154216e4e8c419c5d9ee2dd61aeb71edacd3 100644 --- a/src/Form/FillPdfFormExportForm.php +++ b/src/Form/FillPdfFormExportForm.php @@ -12,7 +12,6 @@ use Drupal\fillpdf\EntityHelper; use Drupal\fillpdf\FillPdfFormInterface; use Drupal\fillpdf\SerializerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\Serializer\Serializer; class FillPdfFormExportForm extends EntityForm { diff --git a/src/Form/FillPdfFormFieldForm.php b/src/Form/FillPdfFormFieldForm.php index 4717fe4a0c1d0fec59ce61a83366804f5236f802..434170b9e53134eee6016fa2fc343105093f042a 100644 --- a/src/Form/FillPdfFormFieldForm.php +++ b/src/Form/FillPdfFormFieldForm.php @@ -1,8 +1,8 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\Form\FillPdfFormFieldForm. - */ + * @file + * Contains \Drupal\fillpdf\Form\FillPdfFormFieldForm. + */ namespace Drupal\fillpdf\Form; @@ -17,6 +17,7 @@ class FillPdfFormFieldForm extends ContentEntityForm { protected $adminFormHelper; public function __construct(FillPdfAdminFormHelperInterface $admin_form_helper) { + parent::__construct($this->entityManager); $this->adminFormHelper = $admin_form_helper; } diff --git a/src/Form/FillPdfFormForm.php b/src/Form/FillPdfFormForm.php index caa76927a18800b0edac7d8bc432714a719060ba..c518347a7f20b6ed461e551ace5914bbeeabbc0f 100644 --- a/src/Form/FillPdfFormForm.php +++ b/src/Form/FillPdfFormForm.php @@ -3,6 +3,7 @@ * @file * Contains \Drupal\fillpdf\Form\FillPdfFormForm. */ + namespace Drupal\fillpdf\Form; use Drupal\Core\Entity\ContentEntityForm; diff --git a/src/Form/FillPdfFormUploadTrait.php b/src/Form/FillPdfFormUploadTrait.php index 48d459c556cb2498f77f6c14f1d2a8462813c039..70d7e0e94323a6ac5a45381d99b506daed15a8ab 100644 --- a/src/Form/FillPdfFormUploadTrait.php +++ b/src/Form/FillPdfFormUploadTrait.php @@ -1,8 +1,8 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\Form\FillPdfFormUploadTrait. - */ + * @file + * Contains \Drupal\fillpdf\Form\FillPdfFormUploadTrait. + */ namespace Drupal\fillpdf\Form; diff --git a/src/Form/FillPdfOverviewForm.php b/src/Form/FillPdfOverviewForm.php index 70e2df65095b02cbdd59f1b94efbb168bcb8f6b9..3f6ed1b5138469203c08e9466f13616eed41e57b 100644 --- a/src/Form/FillPdfOverviewForm.php +++ b/src/Form/FillPdfOverviewForm.php @@ -3,6 +3,7 @@ * @file * Contains \Drupal\fillpdf\Form\FillPdfOverviewForm. */ + namespace Drupal\fillpdf\Form; use Drupal\Core\Entity\Query\QueryFactory; diff --git a/src/Form/FillpdfSettingsForm.php b/src/Form/FillpdfSettingsForm.php index e4dd3b0fcceef4610c026b3426537db8595a52a4..b355920d764144b97c920e02e81c231130adfc6f 100644 --- a/src/Form/FillpdfSettingsForm.php +++ b/src/Form/FillpdfSettingsForm.php @@ -4,6 +4,7 @@ * @file * Contains \Drupal\fillpdf\Form\FillPdfSettingsForm. */ + namespace Drupal\fillpdf\Form; use Drupal\Core\Config\ConfigFactoryInterface; @@ -40,22 +41,22 @@ class FillPdfSettingsForm extends ConfigFormBase { $scheme_options = FillPdfAdminFormHelper::schemeOptions(); - $form['scheme'] = array( + $form['scheme'] = [ '#type' => 'radios', '#title' => $this->t('Template download method'), '#default_value' => $config->get('scheme'), '#options' => $scheme_options, '#description' => $this->t('This setting is used as the download method for uploaded templates. The use of public files is more efficient, but does not provide any access control. Changing this setting will require you to migrate associated files and data yourself and is not recommended after you have uploaded a template.'), - ); + ]; $fillpdf_service = $config->get('backend'); // Assemble service options. Warning messages will be added next as needed. - $options = array( - 'pdftk' => $this->t('Use locally-installed pdftk: You will need a VPS or a dedicated server so you can install pdftk: (!see_documentation).', array('!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf')))), - 'local' => $this->t('Use locally-installed PHP/JavaBridge: You will need a VPS or dedicated server so you can deploy PHP/JavaBridge on Apache Tomcat: (!see_documentation).', array('!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf')))), + $options = [ + 'pdftk' => $this->t('Use locally-installed pdftk: You will need a VPS or a dedicated server so you can install pdftk: (!see_documentation).', ['!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))]), + 'local' => $this->t('Use locally-installed PHP/JavaBridge: You will need a VPS or dedicated server so you can deploy PHP/JavaBridge on Apache Tomcat: (!see_documentation).', ['!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))]), 'fillpdf_service' => $this->t('Use FillPDF Service: Sign up for <a href="https://fillpdf-service.com">FillPDF Service</a>.'), - ); + ]; // Check for JavaBridge. if (!(file_exists(drupal_get_path('module', 'fillpdf') . '/lib/JavaBridge/java/Java.inc'))) { @@ -68,44 +69,44 @@ class FillPdfSettingsForm extends ConfigFormBase { $options['pdftk'] .= '<div class="messages warning">' . $this->t('pdftk is not properly installed.') . '</div>'; } - $form['backend'] = array( + $form['backend'] = [ '#type' => 'radios', '#title' => $this->t('PDF-filling service'), '#description' => $this->t('This module requires the use of one of several external PDF manipulation tools. Choose the service you would like to use.'), '#default_value' => !empty($fillpdf_service) ? $fillpdf_service : 'fillpdf_service', '#options' => $options, - ); - $form['fillpdf_service'] = array( + ]; + $form['fillpdf_service'] = [ '#type' => 'fieldset', '#title' => $this->t('Configure FillPDF Service'), '#collapsible' => TRUE, '#collapsed' => $fillpdf_service !== 'fillpdf_service', - ); - $form['fillpdf_service']['fillpdf_service_api_key'] = array( + ]; + $form['fillpdf_service']['fillpdf_service_api_key'] = [ '#type' => 'textfield', '#title' => $this->t('API Key'), - '#default_value' => $config->get('fillpdf_service_api_key', ''), + '#default_value' => $config->get('fillpdf_service_api_key'), '#description' => $this->t('You need to sign up for an API key at <a href="https://fillpdf-service.com">FillPDF Service</a>'), - ); - $form['fillpdf_service']['remote_protocol'] = array( + ]; + $form['fillpdf_service']['remote_protocol'] = [ '#type' => 'radios', '#title' => $this->t('Use HTTPS?'), '#description' => $this->t('It is recommended to select <em>Use HTTPS</em> for this option. Doing so will help prevent sensitive information in your PDFs from being intercepted in transit between your server and the remote service.'), '#default_value' => $config->get('remote_protocol'), - '#options' => array( + '#options' => [ 'https' => $this->t('Use HTTPS'), 'http' => $this->t('Do not use HTTPS'), - ), - ); - $form['pdftk_path'] = array( + ], + ]; + $form['pdftk_path'] = [ '#type' => 'textfield', '#title' => $this->t('Configure path to pdftk'), '#description' => $this->t("If FillPDF is not detecting your pdftk installation, you can specify the full path to the program here. Include the program name as well. For example, <em>/usr/bin/pdftk</em> is a valid value. You can almost always leave this field blank. If you should set it, you'll probably know."), '#default_value' => $config->get('pdftk_path'), - ); + ]; - $form['#attached'] = array('library' => array('fillpdf/fillpdf.admin.settings')); + $form['#attached'] = ['library' => ['fillpdf/fillpdf.admin.settings']]; return parent::buildForm($form, $form_state); } diff --git a/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php b/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php index 9a018280f80148b6d2bd7beab28fca6f5cc4bd94..8adb6ed3f5281c2cecb431d22f1e8a0788de47bf 100644 --- a/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php +++ b/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php @@ -1,15 +1,14 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\Plugin\FillPdfActionPlugin\FillPdfDownloadAction. - */ + * @file + * Contains \Drupal\fillpdf\Plugin\FillPdfActionPlugin\FillPdfDownloadAction. + */ namespace Drupal\fillpdf\Plugin\FillPdfActionPlugin; use Drupal\Core\Annotation\Translation; use Drupal\fillpdf\Annotation\FillPdfActionPlugin; use Drupal\fillpdf\Plugin\FillPdfActionPluginBase; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\ResponseHeaderBag; diff --git a/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php b/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php index 8db29376dbeabdad128fbf579effd053d1454868..0ef12bbfbb06328246e39dcd1ca32e4f050df3e7 100644 --- a/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php +++ b/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php @@ -8,9 +8,6 @@ namespace Drupal\fillpdf\Plugin\FillPdfActionPlugin; use Drupal\Core\Annotation\Translation; use Drupal\fillpdf\Annotation\FillPdfActionPlugin; -use Drupal\fillpdf\OutputHandler; -use Drupal\fillpdf\Plugin\FillPdfActionPluginBase; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; /** diff --git a/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php b/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php index ae59ef0c30725c8ea7a654f948b74e7964f706fa..a8c77b7460944386843bbc9d5a8351f9e3327f7f 100644 --- a/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php +++ b/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php @@ -7,7 +7,6 @@ namespace Drupal\fillpdf\Plugin\FillPdfBackend; use Drupal\Component\Annotation\Plugin; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Annotation\Translation; use Drupal\Core\File\FileSystem; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; diff --git a/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php b/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php index 7f6629df04e3ea013295b9c4da9da167ef115506..9a3f33aad78626961d4b239c8cdf7bb47986cc09 100644 --- a/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php +++ b/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php @@ -8,7 +8,6 @@ namespace Drupal\fillpdf\Plugin\FillPdfBackend; use Drupal\Component\Annotation\Plugin; use Drupal\Core\Annotation\Translation; -use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\File\FileSystem; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; diff --git a/src/Service/FillPdfContextManager.php b/src/Service/FillPdfContextManager.php index ebce955fd10361a202ed4371487329691e37cb41..3fa72232bdd248ed97c5d18e5b4e60ac4ebd2a4e 100644 --- a/src/Service/FillPdfContextManager.php +++ b/src/Service/FillPdfContextManager.php @@ -1,8 +1,8 @@ <?php /** - * @file - * Contains \Drupal\fillpdf\Service\FillPdfContextManager\FillPdfContextManager. - */ + * @file + * Contains \Drupal\fillpdf\Service\FillPdfContextManager\FillPdfContextManager. + */ namespace Drupal\fillpdf\Service; diff --git a/src/TokenResolverInterface.php b/src/TokenResolverInterface.php index 54f725522e6e885ac8e2ec0840183ad31d04b4c7..fe7d8a23bc34e86149f185fb59922b9e6b3462bd 100644 --- a/src/TokenResolverInterface.php +++ b/src/TokenResolverInterface.php @@ -5,8 +5,6 @@ * Contains \Drupal\fillpdf\TokenResolverInterface. */ - - namespace Drupal\fillpdf; /** diff --git a/xfdf.inc b/xfdf.inc index f253167294f3bec78957522069986d23843bb838..781f4c1a92bf6761e0a82e0bfe76375b36ef8aeb 100644 --- a/xfdf.inc +++ b/xfdf.inc @@ -6,10 +6,8 @@ */ /** - * create_xfdf - * * Takes values passed via associative array and generates XFDF file format - * with that data for the pdf address sullpiled. + * with that data for the PDF address supplied. * * @param string $file The pdf file - url or file path accepted * @param array $info data to use in key/value pairs no more than 2 dimensions