I've created a patch which makes one type-o fix and adds a feature to crm_core_activity_ui_add_activity() which generates the general "Add an activity" page:

  • The title was set to "Add a activity" ('a' instead of 'an') in contrast to the 'title' set in hook_menu(). The fact that MENU_LOCAL_ACTION's don't get their 'title' used is actually a core bug. To work around it, my patch looks up the title used by hook_menu(), so that you don't have to repeat it twice (adhering to the DRY principle - and allowing other modules to use hook_menu_alter() to change the title).
  • When there is only one activity type, it will immediately forward the user to the page to add that type. This is exactly the same as the 'node' module does in it's node_add_page() callback, when there is only one node type.

I'll attach the patch in a moment!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsnopek’s picture

Status: Active » Needs review
FileSize
1.14 KB

Patch attached! Please let me know what you think.

dsnopek’s picture

Heh, after looking at the generated patch I noticed another type-o. New patch attached!

RoSk0’s picture

Status: Needs review » Closed (fixed)

Fix from #2 committed in development branch.

  • Commit c87a548 on development, 7.x-0.x, import by RoSk0:
    Issue #2005306 by dsnopek: Set title from menu item and added redirect...

  • Commit c87a548 on development, 7.x-0.x, import, activity_pages by RoSk0:
    Issue #2005306 by dsnopek: Set title from menu item and added redirect...