Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Plugin for setup template by parent resource
<?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
You can’t perform that action at this time.