From 2bf78b9f5d0e48308259aeefd253780a8331a5e3 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 23 Sep 2025 14:35:40 +0200 Subject: [PATCH] InlineFormView: split off from TabularData template --- templates/InlineFormView.php | 100 +++++++++++++++++++++++++++++++++++ templates/TabularData.php | 94 +------------------------------- 2 files changed, 102 insertions(+), 92 deletions(-) create mode 100644 templates/InlineFormView.php diff --git a/templates/InlineFormView.php b/templates/InlineFormView.php new file mode 100644 index 00000000..b047b6b1 --- /dev/null +++ b/templates/InlineFormView.php @@ -0,0 +1,100 @@ +'; + else + echo ' +
'; + + if (!empty($form['is_group'])) + echo ' +
'; + + if (!empty($form['fields'])) + { + foreach ($form['fields'] as $name => $field) + { + if ($field['type'] === 'select') + { + echo ' + '; + } + else + echo ' + '; + + if (isset($field['html_after'])) + echo $field['html_after']; + } + } + + echo ' + '; + + if (!empty($form['buttons'])) + foreach ($form['buttons'] as $name => $button) + { + echo ' + '; + + if (isset($button['html_after'])) + echo $button['html_after']; + } + + if (!empty($form['is_group'])) + echo ' +
'; + + if (!isset($form['is_embed'])) + echo ' + '; + else + echo ' +
'; + } +} diff --git a/templates/TabularData.php b/templates/TabularData.php index b6df151a..099ae4c8 100644 --- a/templates/TabularData.php +++ b/templates/TabularData.php @@ -3,7 +3,7 @@ * TabularData.php * Contains the template that displays tabular data. * - * Kabuki CMS (C) 2013-2023, Aaron van Geffen + * Kabuki CMS (C) 2013-2025, Aaron van Geffen *****************************************************************************/ class TabularData extends SubTemplate @@ -79,7 +79,7 @@ class TabularData extends SubTemplate // Form controls? if (isset($form)) - $this->renderInlineForm($form); + InlineFormView::renderInlineForm($form); echo ' '; @@ -146,94 +146,4 @@ class TabularData extends SubTemplate echo ' '; } - - protected function renderInlineForm($form) - { - if (!isset($form['is_embed'])) - echo ' -
'; - else - echo ' -
'; - - if (!empty($form['is_group'])) - echo ' -
'; - - if (!empty($form['fields'])) - { - foreach ($form['fields'] as $name => $field) - { - if ($field['type'] === 'select') - { - echo ' - '; - } - else - echo ' - '; - - if (isset($field['html_after'])) - echo $field['html_after']; - } - } - - echo ' - '; - - if (!empty($form['buttons'])) - foreach ($form['buttons'] as $name => $button) - { - echo ' - '; - - if (isset($button['html_after'])) - echo $button['html_after']; - } - - if (!empty($form['is_group'])) - echo ' -
'; - - if (!isset($form['is_embed'])) - echo ' - '; - else - echo ' -
'; - } }