Topics

Action Maps

 Action maps are a killer way to gain some fine-grained control over how your modules work.  Everyone is concerned with user interface, and there is nothing more annoying than seeing your content messed up because it doesn't fit on the page.  Perhaps you have a Theme with a left and right sidebar, but want a large image in the center.  So you create a sub-theme with no sidebars. 

Now, to make sure we are clear, say you are using the news module.  The Summary view shows a nice list of summaries with "read more" links.  This is all fine and good.  The image doesn't show up here.  It shows up when you click "read more."  Now the full view of this single news item appears on the page, but because of the sidebars, you just don't have enough space.  You could shrink the image, but for some reason this just isn't what you want to do.  Here's your ticket.  The "action_maps.php" file in your theme.  Here's a sample:

<?php

##################################################
#
# Copyright (c) 2004-2011 OIC Group, Inc.
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################

if (!defined('EXPONENT')) exit('');

return array(
	'cart'=>array(
                'checkout'=>'Full Body'
				),
	'news'=>array(
                'showByTitle'=>'Large Banner'
				),
	'search'=>array(
                'search'=>'_Search Results'
				),			
	'articlemodule'=>array(
		'edit_article'=>'_default',
		'view_article'=>'Resources',
		'view_category_articles'=>'Resources',
		'show_authors'=>'_default',
				),
	);

?>

 So what's going on there?  Here's the breakdown.

The "cart" module has an action called "checkout", and we are going to force the theme to "Full Body".   This gives us lots of space to work with for the view that is pulled in with that action.

The "news" module has an action called "showByTitle", and we are going to force the theme "Large Banner".  Perhaps you've created a page with a larger banner image space on top, which also happens to not have the sidebars that we were referencing above.  This will give us lots of space for that image that was giving us trouble.

You can see that for the articles module we forced a number of changes.  The more complex your site becomes, the more you may need these action maps for directing exponent.  This is because many actions pull the content straight into the current page, with it's selected theme.  Action maps let you override the theme (or sub-theme) you chose when you initially setup the page.

Freebie...

Oh, and you may have noticed some of the sub-themes above have names that begin with an underscore, such as "_default" and "_Search Results".  While we may want to spank our developers who wrote that code for not using a consistent naming convention, the underscore does help us in that the user never sees these sub-themes.  They are basically utilities, and handy when we need to do something fancy but don't want to clutter up our site admin's user interface.