Let’s say tou want to generate PDFs on the fly in ProcessWire. The application/pdf
content type isn’t available in the Files tab of any given template.
To add new content types you need to add code like this in your config.php
.
$contentTypes = $config->contentTypes;
$contentTypes['pdf'] = 'application/pdf';
$config->contentTypes = $contentTypes;
Note that you can just change $config->contentTypes
directly due to its use of magic methods. If you try it this way you’ll get the following warning: Indirect modification of overloaded property ProcessWire\Config::$contentTypes has no effect
Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from
Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.