For what it worth... modAction entries are deprecated (but still supported for backward compatibility).
Since i started putting my manager controllers in a "default" directory, i ship them with 2 classes within the controller :
File : controllers/default/welcome.class.php
// Revo 2.3 "style"
class MyExtraWelcomeManagerController extends modExtraManagerController
{
// code
}
// Revo 2.2
class MyExtraDefaultWelcomeManagercontroller extends MyExtraMAnagerController
{
}
Since modAction are deprecated, i package 2 menus, and use some validators to find the Revo version and install the appropriate menu :
File build.transport.php
// some code you are used to
// Load menu
$modx->log(modX::LOG_LEVEL_INFO, 'Packaging in menu 2.2...');
$menu = include $sources['data'] . 'transport.menu-2.2.php';
if (empty($menu)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in menu.');
}
$vehicle = $builder->createVehicle($menu, array (
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'text',
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'Action' => array (
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => array ('namespace', 'controller'),
),
),
));
$modx->log(modX::LOG_LEVEL_INFO, 'Adding in PHP resolvers...');
$vehicle->validate('php', array(
'source' => $sources['validators'] . 'modx-2.2.php',
));
$builder->putVehicle($vehicle);
unset($vehicle, $menu);
$modx->log(modX::LOG_LEVEL_INFO, 'Packaging in menu for 2.3+...');
$menu = include $sources['data'] . 'transport.menu-2.3.php';
if (empty($menu)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in menu.');
}
$vehicle = $builder->createVehicle($menu, array (
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'text',
));
$vehicle->validate('php', array(
'source' => $sources['validators'] . 'modx-2.3.php',
));
$builder->putVehicle($vehicle);
unset($vehicle, $menu);
transport.menu-2.3.php being most likely the same as you guys are used to, without the action (so basically just a transport for the modMenu entry), action attribute being the name of your action (welcome in this example).
And a sample validator :
File validators/modx-2.3php
$success = false;
if ($object->xpdo) {
/** @var modX $modx */
$modx =& $object->xpdo;
$modx->getVersionData();
if (version_compare($modx->version['full_version'], '2.3', '>=')) {
$success = true;
} else {
$modx->log(modX::LOG_LEVEL_WARN, 'Skipping menu for MODX Revolution 2.3');
}
}
return $success;
Hope it makes sense and might be helpful