It could be nice if, by default, we try to find if the node currently displayed is a product. If yes, expose the data to jirafe.

Same apply for taxonomy terms. If it is used on a commerce product, expose the data to jirafe from scratch, without need to implements the alter hook.

Comments

haza’s picture

Status: Active » Needs review
StatusFileSize
new3.27 KB

Patch attached.

What do you think about that ?

haza’s picture

StatusFileSize
new2.86 KB

Oops, don't patch the .info file ;)

haza’s picture

StatusFileSize
new2.81 KB

Rerolling on bojanz advices.

amitaibu’s picture

Haven't done a full code review, just one minor from a quick look:

+++ b/jirafe.moduleundefined
@@ -105,6 +105,40 @@ function jirafe_page_alter(&$page) {
+  if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {

Lets use menu_get_object() instead.

guguss’s picture

Status: Needs work » Needs review

@Haza : Can you rebase reroll the patch and apply Amitai's feedback. Then Jirafe is ready for a non-dev release.

That might help ;) :

function taxonomy_term_is_page($term) {
  $page_term = menu_get_object('taxonomy_term', 2);
  return (!empty($page_term) ? $page_term->tid == $term->tid : FALSE);
}
guguss’s picture

Status: Needs review » Needs work
haza’s picture

StatusFileSize
new2.66 KB

Updated the code, using menu_get_object().

guguss’s picture

Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

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