idfive / UniCal-Client

Client Module for the UniCal project.
http://unical.idfive.com
0 stars 2 forks source link

Move unical_client_init logic to unical_client_get #2

Open kmcculloch opened 7 years ago

kmcculloch commented 7 years ago

All the logic in unical_client_init does is add js and css assets that are only needed by a single page, the calendar callback declared by hook_menu at "/calendar". hook_init implementations are called on every Drupal page load and are almost never necessary unless the module is in core or provides a heavy-duty utility.

@drogers98 Would you be open to a pull request to remove unical_client_init and move its logic to the "/calendar" callback at unical_client_get, or is there some particular reason to use hook_init that I haven't considered? (FWIW I understand that hook_init has been removed in Drupal 8 since that level of the bootstrap is now entirely handled by Symfony.)

drogers98 commented 7 years ago

I am totally open to that. In fact I believe that adding as a hook_init was simply an oversight on my part. I was grabbing and modifying code from another module, and didn't stop to consider that. Great catch!