From 60dae57fb003c3d3193219080e862feb8f0383dc Mon Sep 17 00:00:00 2001 From: Repellent Date: Wed, 3 Dec 2025 11:53:55 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B2=20=D0=BF=D0=BE=D0=BB=D0=B5=20=D0=A1?= =?UTF-8?q?=D1=81=D1=8B=D0=BB=D0=BA=D0=B0=20=D0=BD=D0=B0=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D0=BF=D0=BE=D0=BB=D0=B5=20=D0=97=D0=B0?= =?UTF-8?q?=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fields/doc_link/field.php | 18 +++++++++++++++++- fields/doc_link/tpl/field.tpl | 29 ++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/fields/doc_link/field.php b/fields/doc_link/field.php index 8082d2c..a7b9301 100644 --- a/fields/doc_link/field.php +++ b/fields/doc_link/field.php @@ -11,7 +11,6 @@ * @license GPL v.2 */ - // Ссылка function get_field_doc_link($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null) { global $AVE_Template; @@ -39,6 +38,23 @@ $clean_field_value .= '|' . $field_param[1]; } + $doc_id = 0; + $document_name_to_display = ''; + + if (preg_match('/id=([0-9]+)/i', $clean_field_value, $matches)) { + $doc_id = (int)$matches[1]; + } + + if ($doc_id > 0) { + $document_data = get_document($doc_id); + if ($document_data && !empty($document_data['document_title'])) { + $document_name_to_display = $document_data['document_title']; + } elseif ($doc_id === 1) { + $document_name_to_display = 'Главная страница'; + } + } + + $AVE_Template->assign('display_value', $document_name_to_display); $AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_value', $clean_field_value); diff --git a/fields/doc_link/tpl/field.tpl b/fields/doc_link/tpl/field.tpl index e007f13..ad4b72a 100644 --- a/fields/doc_link/tpl/field.tpl +++ b/fields/doc_link/tpl/field.tpl @@ -1,2 +1,29 @@ + + +
+ +
+   - \ No newline at end of file + + \ No newline at end of file