mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
improve custom field render
This commit is contained in:
@@ -409,7 +409,15 @@ JS;
|
|||||||
$customFields = $this->listTorrentCustomField($torrentId);
|
$customFields = $this->listTorrentCustomField($torrentId);
|
||||||
$mixedRowContent = get_searchbox_value($browsecatmode, 'custom_fields_display');
|
$mixedRowContent = get_searchbox_value($browsecatmode, 'custom_fields_display');
|
||||||
$rowByRowHtml = '';
|
$rowByRowHtml = '';
|
||||||
|
$shouldRenderMixRow = false;
|
||||||
foreach ($customFields as $field) {
|
foreach ($customFields as $field) {
|
||||||
|
if (empty($field['custom_field_value'])) {
|
||||||
|
//No value, remove special tags
|
||||||
|
$mixedRowContent = str_replace("<%{$field['name']}.label%>", '', $mixedRowContent);
|
||||||
|
$mixedRowContent = str_replace("<%{$field['name']}.value%>", '', $mixedRowContent);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$shouldRenderMixRow = true;
|
||||||
$contentNotFormatted = $this->formatCustomFieldValue($field, false);
|
$contentNotFormatted = $this->formatCustomFieldValue($field, false);
|
||||||
$mixedRowContent = str_replace("<%{$field['name']}.label%>", $field['label'], $mixedRowContent);
|
$mixedRowContent = str_replace("<%{$field['name']}.label%>", $field['label'], $mixedRowContent);
|
||||||
$mixedRowContent = str_replace("<%{$field['name']}.value%>", $contentNotFormatted, $mixedRowContent);
|
$mixedRowContent = str_replace("<%{$field['name']}.value%>", $contentNotFormatted, $mixedRowContent);
|
||||||
@@ -419,7 +427,7 @@ JS;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = $rowByRowHtml;
|
$result = $rowByRowHtml;
|
||||||
if (!empty($mixedRowContent)) {
|
if ($shouldRenderMixRow) {
|
||||||
$result .= tr($displayName, format_comment($mixedRowContent), 1);
|
$result .= tr($displayName, format_comment($mixedRowContent), 1);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Reference in New Issue
Block a user