@@ -191,6 +191,22 @@ public static function showForForm(CommonDBTM $item, $withtemplate = '') {
191
191
return true ;
192
192
}
193
193
194
+ public function getDesignLabel (): string {
195
+ $ questionId = $ this ->getID ();
196
+ $ nb = (new DBUtils ())->countElementsInTable (PluginFormcreatorCondition::getTable (), [
197
+ 'itemtype ' => PluginFormcreatorQuestion::getType (),
198
+ 'items_id ' => $ questionId ,
199
+ ]);
200
+ $ sectionId = $ this ->fields [PluginFormcreatorSection::getForeignKeyField ()];
201
+ $ onclick = 'plugin_formcreator.showQuestionForm( ' . $ sectionId . ', ' . $ questionId . '); ' ;
202
+ $ html = '<a href="javascript: ' . $ onclick . '" data-field="name"> ' ;
203
+ $ html .= "<sup class='plugin_formcreator_conditions_count' title=' " . __ ('Count of conditions ' , 'formcreator ' ) ."'> $ nb</sup> " ;
204
+ $ html .= empty ($ this ->fields ['name ' ]) ? '( ' . $ questionId . ') ' : $ this ->fields ['name ' ];
205
+ $ html .= '</a> ' ;
206
+
207
+ return $ html ;
208
+ }
209
+
194
210
/**
195
211
* Get the HTML for the question in form designer
196
212
*
@@ -218,16 +234,8 @@ public function getDesignHtml() : string {
218
234
219
235
// Question name
220
236
$ html .= $ field ->getHtmlIcon () . ' ' ;
221
- $ onclick = 'plugin_formcreator.showQuestionForm( ' . $ sectionId . ', ' . $ questionId . '); ' ;
222
- $ html .= '<a href="javascript: ' . $ onclick . '" data-field="name"> ' ;
223
237
// Show count of conditions
224
- $ nb = (new DBUtils ())->countElementsInTable (PluginFormcreatorCondition::getTable (), [
225
- 'itemtype ' => PluginFormcreatorQuestion::getType (),
226
- 'items_id ' => $ this ->getID (),
227
- ]);
228
- $ html .= "<sup class='plugin_formcreator_conditions_count' title=' " . __ ('Count of conditions ' , 'formcreator ' ) ."'> $ nb</sup> " ;
229
- $ html .= empty ($ this ->fields ['name ' ]) ? '( ' . $ questionId . ') ' : $ this ->fields ['name ' ];
230
- $ html .= '</a> ' ;
238
+ $ html .= $ this ->getDesignLabel ();
231
239
232
240
// Delete the question
233
241
$ html .= "<span class='form_control pointer'> " ;
0 commit comments