SugarCRM: Extending the action_view_map file

sugarcrmdevelopers —  March 12, 2012

Recently I began working on some custom scripts to export workflows.  I wanted to make this int a module loadable package so it’s easy to install and use.  I was looking around to how to add the files to the admin without having to build a full on custom module since I just need one screen with some options.  I was looking into how to extend the action_view_map.php file in the Administration module and I came across a bit of code that I figured would be useful to share.

In the custom directory you can build out a series of Extensions by adding files to specific folders.  I found this to be useful when doing vardefs change, language files and laoudefs changes.  What I didn’t know was that you can add the following and it will build them out as well:

  • EntryPointRegistry
  • ActionViewMap
  • ActionFileMap
  • ActionRemap
  • Menus
So if i wanted to add a new action to the Administration module I would just do the following:
  1. Create a new file in custom/Extensions/modules/Administration/Ext/ActionViewMap/.php
  2. Add the code in: <?php $action_view_map[‘action_name’] = ‘action_name’; ?>
  3. Run Repair and Rebuild
  4. Goto new action via direct link or a link from someplace.

I’m sure there are more that can be added and if you know of them please post them in the comments and I will update this post.