Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to override config settings in Fluid template #39

Closed
maechler opened this issue Apr 3, 2018 · 2 comments
Closed

Add possibility to override config settings in Fluid template #39

maechler opened this issue Apr 3, 2018 · 2 comments

Comments

@maechler
Copy link
Member

maechler commented Apr 3, 2018

It should be possible to overwrite settings defined in plugin.tx_pdfviewhelpers.settings.config within the Fluid template. E.g.

<pdf:document config="{class: 'Vendor\Extension\YourClass'}"></pdf:document>

or

<pdf:config key="class" value="Vendor\Extension\YourClass"></pdf:config>
@maechler
Copy link
Member Author

maechler commented Sep 7, 2018

Unfortunately this is not very easy to implement. Fluid initialises all child ViewHelper arguments (using initializeArguments) before it calls initialize on the top most ViewHelper. But only in the method initialize we get acccess to the ViewHelper arguments that enable us to overwrite the settings. Thus all ViewHelper arguments of the children are already initialized with their corresponding default value before we can overwrite the default settings used.

We would have to rewrite the entire initialization of the ViewHelper arguments, I do not think that this feature is worth that. We should however move some config settings to a ViewHelper where they can be overwritten using Fluid attributes.
The config language and hyphenFile should be moved to the DocumentViewHelper in order to be able to generate multi language PDF documents as a batch job.

config {
class = Bithost\Pdfviewhelpers\Model\EmptyFPDI
language = ger
hyphenFile = hyph-de-ch-1901.tex
disableCache = 1
jpgQuality = 100
sRGBMode = 0
allowedImageTypes {
image = jpg,png,gif
imageEPS = ai,eps
imageSVG = svg
}
fonts {
subset = 1
addTTFFont {
# roboto {
# path = EXT:pdfviewhelpers/Resources/Public/Examples/FullFeatureShowCase/Roboto.ttf
# }
# opensans {
# path = EXT:pdfviewhelpers/Resources/Public/Examples/FullFeatureShowCase/OpenSans.ttf
# }
}
}
}

@macjohnny What do you think?

@maechler
Copy link
Member Author

Implemented as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant