Skip to content

Commit 0db0cd8

Browse files
author
Szymon Olewniczak
committed
feature: hidden fields in bueraucracy form from struct fields
This commit adds extra syntax which allow us to add struct fields to bureaucracy forms as hidden fields: struct_fieldhidden "products.product" "=value" This only make sense with cosmocode#354
1 parent fd85dc6 commit 0db0cd8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

helper/fieldhidden.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Allows adding a single struct field as a bureaucracy hidden field
4+
*
5+
* This class is used when a field of the type struct_fieldhidden is encountered in the
6+
* bureaucracy syntax.
7+
*/
8+
class helper_plugin_struct_fieldhidden extends helper_plugin_struct_field {
9+
/**
10+
* Render the field as XHTML
11+
*
12+
* Outputs the represented field using the passed Doku_Form object.
13+
*
14+
* @param array $params Additional HTML specific parameters
15+
* @param Doku_Form $form The target Doku_Form object
16+
* @param int $formid unique identifier of the form which contains this field
17+
*/
18+
function renderfield($params, Doku_Form $form, $formid) {
19+
$this->_handlePreload();
20+
$form->addHidden($params['name'], $this->getParam('value') . '');
21+
}
22+
}

0 commit comments

Comments
 (0)