И так, чуток дописал Дитто и библиотеку
tmplvars.format.inc
Дитто может использовать только контент ТВ при назначенном виджите ТиниМСЕ или дргом редакторе.
1) При вызове сниппета прописываем дополнительный параметр: &onlyRtTVContent=`ИмяПеременной1,ИмяПеременной2,...,ИмяПеременнойN`
2) Добавляем в сниппет Дитто строку $onlyRtTVContent = !empty($onlyRtTVContent)? $onlyRtTVContent : ’’; , после или перед определения любого другова параметра.
3) Заменяем 931 строку в сниппете ($resource = $ditto->getDocuments($documentIDs, $dbFields, $TVs, $keywords, $showPublishedOnly, 0, $where, $queryLimit, $sortBy, $sortDir,$randomize); )
на $resource = $ditto->getDocuments($documentIDs, $dbFields, $TVs, $keywords, $showPublishedOnly, 0, $where, $queryLimit, $sortBy, $sortDir,$randomize,$onlyRtTVContent);
4) в файле
ditto.class.inc.php заменяем 2 строки функции
getDocuments:
1(0) строка;
function getDocuments($ids= array (), $fields, $TVs, $keywords, $published= 1, $deleted= 0, $where= '', $limit= "", $sort= "id", $dir= "ASC", $randomize=0, $onlyRtTVContent='') {
55(54) строка;
$TVData = array_merge_recursive($this->appendTV($tv,$TVIDs,$onlyRtTVContent),$TVData);
5) в этомже файле заменяем 1, 21, 30 строки функции
appendTV: и дописываем 3 строку:
1(0) строка;
function appendTV($tvname="",$docIDs,$onlyRtTVContent=''){
3(пустая) строка;
$onlyRtTVContent = !empty($onlyRtTVContent) ? explode(",",$onlyRtTVContent) : false;
21(20) строка;
$resourceArray["#".$row['contentid']][$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'],$row['contentid'],$onlyRtTVContent);
30(29) строка;
$defaultOutput = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type'],$row['contentid'],$onlyRtTVContent);
6) в файле
tmplvars.format.inc.php переписываем 8(1) строку:
function getTVDisplayFormat($name,$value,$format,$paramstring="",$tvtype="",$docid="",$onlyRtTVContent='') {
,а также переписываем
case: "richtext":
case "richtext":
if (is_array($onlyRtTVContent) && in_array($name, $onlyRtTVContent)) {
$value = parseInput($value);
$o= $value;
}else {
$value = parseInput($value);
$w = $params['w']? $params['w']:'100%';
$h = $params['h']? $params['h']:'400px';
$richtexteditor = $params['edt']? $params['edt']: "";
$o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
$o.= htmlspecialchars($value);
$o.= '</textarea></div>';
$replace_richtext = array($id);
// setup editors
if (!empty($replace_richtext) && !empty($richtexteditor)) {
// invoke OnRichTextEditorInit event
$evtOut = $modx->invokeEvent("OnRichTextEditorInit",
array(
'editor' => $richtexteditor,
'elements' => $replace_richtext,
'forfrontend'=> 1,
'width' => $w,
'height' => $h
));
if(is_array($evtOut)) $o.= implode("",$evtOut);
}
}
break;
Вот и все дела. Пригодилась мне может камунить еще пригодится данная штука.