This will reduce memory footprint as Ubercart does not need its theme functions to be loaded for all page requests.

Comments

tr’s picture

Status: Active » Needs review
StatusFileSize
new82.99 KB

Here's a patch. Not sure how much this actually saves ... The .theme.inc files total only about 30 kb / 1000 lines of code.

 payment/uc_credit/uc_credit.module      |   18 +--
 payment/uc_credit/uc_credit.theme.inc   |   20 ++
 payment/uc_payment/uc_payment.module    |   24 +---
 payment/uc_payment/uc_payment.theme.inc |   29 +++
 shipping/uc_quote/uc_quote.module       |   54 +------
 shipping/uc_quote/uc_quote.theme.inc    |   58 ++++++
 shipping/uc_shipping/uc_shipping.module |    1 +
 shipping/uc_ups/uc_ups.module           |   36 +----
 shipping/uc_ups/uc_ups.theme.inc        |   38 ++++
 shipping/uc_usps/uc_usps.module         |   37 +----
 shipping/uc_usps/uc_usps.theme.inc      |   39 ++++
 uc_attribute/uc_attribute.module        |   50 +-----
 uc_attribute/uc_attribute.theme.inc     |   55 ++++++
 uc_cart/uc_cart.module                  |  299 +-----------------------------
 uc_cart/uc_cart.theme.inc               |  295 ++++++++++++++++++++++++++++++
 uc_catalog/uc_catalog.module            |   72 +-------
 uc_catalog/uc_catalog.theme.inc         |   76 ++++++++
 uc_file/uc_file.module                  |   78 +--------
 uc_file/uc_file.theme.inc               |   82 +++++++++
 uc_product/uc_product.module            |  219 +----------------------
 uc_product/uc_product.theme.inc         |  217 ++++++++++++++++++++++
 uc_product_kit/uc_product_kit.module    |   93 ++--------
 uc_product_kit/uc_product_kit.theme.inc |   79 ++++++++
 uc_roles/uc_roles.module                |   82 +--------
 uc_roles/uc_roles.theme.inc             |   86 +++++++++
 uc_store/uc_store.module                |  112 +-----------
 uc_store/uc_store.theme.inc             |  112 ++++++++++++
 27 files changed, 1241 insertions(+), 1120 deletions(-)
tr’s picture

Probably should also add a uc_store_update_N() to clear the theme cache ...

tr’s picture

StatusFileSize
new84.56 KB

This version is the same as #1, except it adds an update function to rebuild the theme registry. That should take care of any transient problems people might have when upgrading.

tr’s picture

@longwave, @Island Usurper: Either of you think this should be done? If not we can just close this out.

longwave’s picture

You may as well commit it now you've done the work! Untested but looks okay to me.

I think this patch might help themers if they can see more easily what they can (and can't) change. Maybe we could even add a new Doxygen group for Ubercart specific theme functions?

tr’s picture

Yeah, I think the biggest advantage to doing this is to make the code more modular and easier to deal with, rather than any memory savings. It will also make it simpler to replace some of the theme functions by templates, if that's something we decide to do. Certainly adding doxygen groups is something we should tackle, not just for the theme functions but for other functions as well - it would be nice to have a top-level index of Ubercart functions at api.ubercart.me instead of having everything all mixed up with Drupal functions. To do this we would have to start defining doxygen groups. The Examples module is a good model for this.

longwave’s picture

Status: Needs review » Fixed

Committed #3

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

venkirs’s picture

how to create invoice template for using dompdf can give example coding