Topics

Action Maps

Need the action of certain modules to use a different subtheme? Use Action Maps to tell what theme variation to use.

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. 

Additionally, some pages displayed in Exponent are not determined by an 'edit page' entry because they are dynamic pages.  For example, you have a list of Blog entries on the home page which you have set a theme variation.  However when you select one of those Blog entires, the site is sent to a dynamic page created using the 'show' method.  While the Home page would have the desired theme variation, the new dynamic page would be based on the default theme.

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.  

The entries also allow for 'wildcards' so you can apply the theme variation to all actions of a particular module, or for all modules using a particular action name.

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('');

// the module may be a wildcard (meaning all modules) by using an asterisk '*'
// the action may be a wildcard (meaning all methods) by using an asterisk '*'
return array(
 'cart'=>array(  // the 'cartController' module
     'checkout'=>'Full Body'  // the 'checkout' method will use the 'Full Body' subtheme
 ),
 'news'=>array(
     'show'=>'Large Banner'
 ),
 'search'=>array(
     'search'=>'_Search Results'
 ),   
 'article'=>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 "show", 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.

Loading Help