Created
June 12, 2016 03:46
-
-
Save Realetive/b92384dc615cd481e5f436d586a2d82f to your computer and use it in GitHub Desktop.
Plugin for setup template by parent resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( $modx->event->name == 'OnDocFormRender' && $mode == modSystemEvent::MODE_NEW ) { | |
$template = $modx->runSnippet( 'pdoField', array( | |
"id" => $_REQUEST['parent'] | |
, "field" => "template" | |
, "top" => 0 | |
) ); | |
switch ( $template ) { | |
case 1: | |
$template = 2; | |
break; | |
default: | |
$template = 1; | |
break; | |
} | |
$modx->controller->setProperty( 'template', $template ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment