It would be nice if one could write ctool plugins to add variables (much like one does with the hook_omniture_variables.

This can be helpful if one module wants to implement several hooks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

e2thex’s picture

FileSize
1.67 KB

I have attached a patch that use the hook_omniture_variables to pull in ctool plugin data.

This could also be done as a separate module, but I do not think it is very expensive and is a small addition. So it would be nice if it could get in to the omniture module

e2thex’s picture

If someone has a change it would be nice to know if you all are interesting in this being part of the omniture module. If not I could easily put this in is own module.

greggles’s picture

Status: Active » Needs review

I don't see how this is really very useful, can you explain why this is more useful than the current hook_omniture_variables?

greggles’s picture

Also, I don't think a separate module/project on drupal.org is a great idea.

If there are more ideas like this which make sense to go in a submodule then we can make you a maintainer on this module as well and have you maintain the submodule inside of this drupal.org project.

e2thex’s picture

Here is the path we went down and end up want to use ctools.

First we have a custom module to set our omniture variables. We have 8 or so different actions for setting variables (eg, one for title and section, for for extra fields on blog posts, one for user data, etc) and we want to have a inc file for each of this, so then our hook would look like this:

function CUSTOM_omniture_variables($main) {
  $variables = array_merge($variables, custom_title_omniture_variables($main));
  $variables = array_merge($variables, custom_blog_omniture_variables($main));
  ...
  ...
  ...
  return $variables;
}

I would also then have to include each of those files.

I was about this time that I realized I was recreating ctools plugins (poorly).

In general I find that ctools plugins allow a more flexibility in organizing a large module. It let me implement the hook more then one time in a module, this way I can group code on activity not on what hook is getting used.

I would be happy to maintain it as a submodule if that is the way you want to go.

e2thex’s picture

FileSize
6.11 KB

I have attached a patch that does it as a sub module

e2thex’s picture

FileSize
2.16 KB

Sorry last patch had .svn junk