Hi Guys,
I am using formit2rescource to add docs from the front end.
How can I set the menu index to the next index number. It is currently just being set as 0.
$doc->set(’menuindex’, ’??????’);
Stuart
this is from processors/resource/create.php:
/* increase menu index if this is a new resource */
$auto_menuindex = $workingContext->getOption('auto_menuindex', true);
if (!empty($auto_menuindex) && empty($scriptProperties['menuindex'])) {
$scriptProperties['menuindex'] = $modx->getCount('modResource',array(
'parent' => $resource->get('parent'),
'context_key' => $scriptProperties['context_key'],
));
}
$resource->set('menuindex',!empty($scriptProperties['menuindex']) ? $scriptProperties['menuindex'] : 0);
you can also try to use the runProcessor-method
http://api.modx.com/revolution/2.1/ for creating resources.