we make a major assumption when setting up the Activity templates that the hook is the exact same as the module. hook_hook_info() allows for clean separation of this (the first key is the module, the next keys are the hooks). I don't have the patience right now to unwind it, but its all in activity.admin.inc

We should be able to module_invoke_all('hook_info') and then find the module that has the hook (array_filter) and then we can use that hook_info in _activity_Settings_form_operations.

Anyways, its kindof a holy mess. That I don't feel like fixing right this minute.

CommentFileSizeAuthor
#6 form_state.txt4.35 KBfizk

Comments

Scott Reynolds’s picture

Status: Active » Fixed
jtsnow’s picture

This appeared to me to be an issue in other places besides just the admin interface. For example, I've created an og_activity module (I plan to contribute it soon!). I found that some hooks had to be implemented on behalf of the 'og' module rather than my 'og_activity' module.

The hooks that I noticed this for are:
- hook_activity_info
- hook_activity_grants
- hook_activity_access_grants
- hook_activity_type_check

Does this latest commit fix this problem as well or does it only fix the problems on the admin page?

Scott Reynolds’s picture

there still might be more gems in there. But we now have a function for it activity_module_name($hook).

So lets find the spots and fix. Create issues for each hook as you see them and we can fix it up.

Scott Reynolds’s picture

Status: Fixed » Needs work

Found a gem! can't reconfigure a template. $hook isn't set.

Scott Reynolds’s picture

Status: Needs work » Fixed
fizk’s picture

StatusFileSize
new4.35 KB

Still breaks when modifying an existing template. $hook is NULL for some reason...

I've attached var_dump( $form_state ). Using CVS.

I hope this isn't another epic issue :P

Scott Reynolds’s picture

Status: Fixed » Postponed (maintainer needs more info)

Ok what are you trying to do thats failing?

How I found the first gem was I tried to edit an existing template and after I clicked save I got the following messages:

* notice: Undefined index: hook in /Users/scott/scott_contrib/activity-DRUPAL-6--2/activity.admin.inc on line 118.
* warning: call_user_func(_activity_info) [function.call-user-func]: First argument is expected to be a valid callback in /Users/scott/scott_contrib/activity-DRUPAL-6--2/activity.admin.inc on line 122.
* notice: Trying to get property of non-object in /Users/scott/scott_contrib/activity-DRUPAL-6--2/activity.admin.inc on line 124.
* warning: Invalid argument supplied for foreach() in /Users/scott/scott_contrib/activity-DRUPAL-6--2/activity.admin.inc on line 124.

And the save doesn't work. With the fix it does work with no messages.

fizk’s picture

Creating a new template with messages works, but editing an existing template doesn't because $hook is NULL.

fizk’s picture

Dam, I don't have the latest cvs!

Scott Reynolds’s picture

Status: Postponed (maintainer needs more info) » Fixed

then its fixed ;-)

Thats why I try to post a link to the commit. Just click the link and verify the lines match.

Status: Fixed » Closed (fixed)

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