-
-
Save Advanc8d/79b8a4cb2e49eb9398fe0344223b8f22 to your computer and use it in GitHub Desktop.
Кастомные поля для комментариев (Tickets Modx)
This file contains hidden or 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
/* Плагин с событием на OnBeforeCommentSave | |
https://modx.pro/help/4370 | |
https://bezumkin.ru/sections/522/1540/ */ | |
if ($modx->event->name == 'OnBeforeCommentSave') { | |
if(!empty($_POST['my_property_prop'])){ | |
$properties = array( | |
'my_property' => $modx->stripTags($_POST['my_property_prop']) | |
); | |
} else { | |
$properties = array( | |
'my_property' => $modx->stripTags($_POST['my_property']) | |
); | |
} | |
$modx->event->params['TicketComment']->set('properties', $properties); | |
} | |
/* core/components/tickets/processors/mgr/comment/get.class.php | |
Костыль для функции cleanup() */ | |
if (isset($comment['properties'])) { | |
foreach($comment['properties'] as $comment_key => $comment_value) { | |
$comment[$comment_key."_prop"] = $comment_value; | |
} | |
} | |
/* assets/components/tickets/js/mgr/comment/comment.window.js | |
Добавление нового поля в getFields */ | |
{ | |
xtype: 'textarea', | |
fieldLabel: _('comment'), | |
name: 'my_property_prop', | |
} | |
/* Вывод в чанке */ | |
[[+properties.gender]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment