Split form generation code to a separate file
| Project: | Category |
| Version: | 6.x-2.0-rc1 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
The basic category.module file is quite large (78kB). This is not really nice for both development (quite big to read through), and for performance (not really a big difference, but still a bit - this is why D6 splits admin and page code to separate files). Reading through the file, I see that there's a lot of code related to forms, which generally runs on very few pages - node forms, and administrative content type forms.
Rough estimate (done by approximate deletion on a copy of category.module, then comparison of file sizes) shows, that we can save about 1/3 of the file, having category.module down to some 51kB, if we split the forms related code out to separate file(s).
The code for administrative content type form may well belong to category.admin.inc, the code for node forms might get a new include file category.forms.inc or similar. Obviously, we can't really put hook_form_alter() into extra file, but what we can do is: Have a tiny hook_form_alter() skeleton in category.module, and load the extra file as needed in there, invoking it's functions afterwards. These functions in the extra file will then contain the actual mass of code.
This is a simple copy&paste task, obviously with a bit of testing afterwards. I'm postponing it now, as it's going to change the files a lot, colliding with other, more critical patches at this moment, but I write the plan down so that we don't forget about the idea. I hope to revisit this, when category code is more stable.
