GravityPDF / gravity-pdf

Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using Gravity Forms.
https://gravitypdf.com
88 stars 21 forks source link

Allow a maximum of 8 User-Defined CSS Classes in Core Template #1428

Closed jestonihpi closed 1 year ago

jestonihpi commented 1 year ago

This PR set a limited amount of custom CSS per field in PDF generation. We still process the PDF but were going to ignore the rest of these custom CSS and log the "excluded" along side with its field information.

WIP - Unit test

Description

1425

Testing instructions

In the Form field settings, add 8 or more user defined CSS class. Check the PDF's html (?html=1) to see if limits the classes.

Screenshots

image image

Checklist:

Additional Comments

codecov[bot] commented 1 year ago

Codecov Report

Merging #1428 (7c22b0e) into development (f6e0cb4) will increase coverage by 17.30%. The diff coverage is n/a.

:exclamation: Current head 7c22b0e differs from pull request most recent head f042061. Consider uploading reports for the commit f042061 to get more accurate results

@@                Coverage Diff                 @@
##             development    #1428       +/-   ##
==================================================
+ Coverage          75.99%   93.30%   +17.30%     
==================================================
  Files                243       57      -186     
  Lines              10129     1464     -8665     
  Branches             370      370               
==================================================
- Hits                7698     1366     -6332     
+ Misses              2423       90     -2333     
  Partials               8        8               
Impacted Files Coverage Δ
src/Helper/Helper_Abstract_Fields.php
src/Helper/Fields/Field_Chainedselect.php
src/Helper/Fields/Field_Signature.php
src/Model/Model_Shortcodes.php
src/Helper/Fields/Field_Quiz.php
src/Helper/Fields/Field_Shipping.php
src/Helper/Fonts/FlushCache.php
src/Helper/Fields/Field_V3_Products.php
src/Helper/Fields/Field_Number.php
src/Controller/Controller_Settings.php
... and 176 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

jestonihpi commented 1 year ago

Hi @jakejackson1, I have added the unit test for this pr and updated the logic of the get_field_classes method.

jakejackson1 commented 1 year ago

@jestonihpi ah, I see the logger isn't available in this class directly. Because of the extra verbosity required to log messages here, I think we should just remove it and silently drop and additional classes after #8. That should condense this new method down to a line or two.

Also, this would be for Gravity PDF 6.5.2 and the @version docblock should be updated accordingly.