When using YAMS and managermanager, normally, the "internal name"
(pagetitle) is the same as the language specific title
(at least for english if not more..)
here’s a simple managermanager widget to do that automatically
(enough with the copy&paste..)
a. create the synctitle folder:
\assets\plugins\managermanager\widgets\synctitle
b. put the attached
synctitle.php
c. in your mm_rules chunk, add this line at the end:
mm_widget_synctitle(’en,ko’);
(or whatever languages you want the internal name to be synced to, comma separated)
It will sync on initial entry, and then later, if needed - there’s the ’force sync’ link.
good luck
synctitle.php
<?php
//---------------------------------------------------------------------------------
// mm_widget_synctitle
// Auto sync Internal Name (pagetitle) to other languages
//---------------------------------------------------------------------------------
function mm_widget_synctitle($langs='', $roles='', $templates='') {
global $modx, $content, $mm_fields;
$e = &$modx->Event;
if (useThisRule($roles, $templates)) {
$output = '';
if (isset($content['template'])) {
$page_template = $content['template'];
} else {
$page_template = $modx->config['default_template'];
}
$langs = makeArray($langs);
if (empty($langs)) return;
$tvIds = array();
foreach ($langs AS $lang) {
$tvIds[] = '#' . $mm_fields['pagetitle_'.$lang]['fieldname'];
}
$output .= "// ---------------- mm_widget_synctitle ------------- \n";
$output .= '
$j("input[name=pagetitle]").blur(function(){
var newVal = $j(this).val();
$j("'.implode( "," , $tvIds ).'").each(function(){
if ($j(this).val() == "") {$j(this).val(newVal);}
});
});
$j("input[name=pagetitle]").parent().append("<a href=\"#\">(sync titles)</a>").click(function(){
var newVal = $j("input[name=pagetitle]").val();
$j("'.implode( "," , $tvIds ).'").val(newVal);
return false;
});
';
}
$e->output($output . "\n");
}
?>