Implementation of hook_requirements for spyc
benoit.borrel - May 12, 2009 - 18:56
| Project: | Patterns |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hello,
I had to dig into the code to understand why the module was not taking my YAML files into account. It was because the module, through its function patterns_file_types checks that spyc.php file exists in folder spyc.
So, here is a patch implementing hook_requirements in order to have the module being verbose about this requirement.
Hope this help.
| Attachment | Size |
|---|---|
| patterns.install_requirements.patch | 2.02 KB |

#1
Thanks for the report and patch!
Actually YAML isn't a requirement to use the module since it can fully work with XML as well without any separate download. Because of this I'm not sure it would be best to include it as a requirement because then everyone would have to download the YAML library even if they don't plan to use the YAML format.
I think the best approach would be for the module to offer more help and useful information in the administrative pages. For instance, when the module is installed and on other patterns admin pages, it should have a notice such as:
"YAML SPYC Library was not detected. You will not be able to use YAML patterns until the library is downloaded and extracted to your Patterns module directory. Please download the library here: http://code.google.com/p/spyc)"
When it's installed it could give a notice to the effect of:
"YAML SPYC library detected. YAML support is now enabled."
What do you think? Any better ideas?