I am looking for suggestions how to modify the Textimage Autoinsert module so I can limit it to work on only one or two themes.

Comments

danielb’s picture

Category: support » feature

I think you would have to change this function

function textimage_autoinsert_theme_registry_alter(&$theme_registry) {
  $theme_registry['page']['preprocess functions'][] = 'textimage_autoinsert_preprocess_vars';
}

and add an 'if test' like so:

function textimage_autoinsert_theme_registry_alter(&$theme_registry) {
  if (???) {
    $theme_registry['page']['preprocess functions'][] = 'textimage_autoinsert_preprocess_vars';
  }
}

If you figure out what condition to test for, let me know. I assume the theme name is available in $theme_registry, but if not you'll have to access some globals. You can find out what variables are available globally with get_defined_vars() I think it would be in $theme_path or $theme_info, etc...

It's a good idea for a feature to be able to choose this somewhere, I'll consider adding that one day, so lets leave this open as a feature request

TomMynd’s picture

Hi,

this would be a nice feature. You can get the "theme_key" as a global variable and test for that:

function textimage_autoinsert_theme_registry_alter(&$theme_registry) {
  global $theme_key;
  if ($theme_key == 'the_theme_name') {
    $theme_registry['page']['preprocess functions'][] = 'textimage_autoinsert_preprocess_vars';
  }
}

the_theme_name would be the key/name of the theme.

The configuration could be inside the autoinserts preset. Choose for which themes this preset will be used. A link how to get all available themes for the select field: http://drupal.org/node/46961

When I got some time I will test it with my installation and will post the results here.

danielb’s picture

Status: Active » Fixed

This will be supported in the Dev version of this module. That also means you will need the Dev version of Textimage, because the current recommended release of Textimage is a year old and no longer compatible.

dltampa’s picture

Thanks for your help on this guys. I am going to try this later this week. I will let you know how it goes.

TomMynd’s picture

Hi,

I had the time to test it and it worked for me.

Best regards, Tom

dltampa’s picture

I was able to test it and it works. It's just what I needed. Thanks for the quick work. David

Status: Fixed » Closed (fixed)

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