Explorar o código

updated UI::hButtonPost - added childrens arg

Piotr Labudda %!s(int64=9) %!d(string=hai) anos
pai
achega
71151c82b0
Modificáronse 1 ficheiros con 5 adicións e 6 borrados
  1. 5 6
      SE/se-lib/UI.php

+ 5 - 6
SE/se-lib/UI.php

@@ -292,15 +292,14 @@ class UI {
 		UI::endTag('form');
 	}
 
-	public static function hButtonPost($label, $params = []) {
-		$fields = [];
-		if (!empty($params['data'])) foreach ($params['data'] as $k => $v) $fields[] = self::h('input', ['type'=>'hidden', 'name'=>$k, 'value'=>$v]);
+	public static function hButtonPost($label, $params = [], $childrens = []) {
+		if (!empty($params['data'])) foreach ($params['data'] as $k => $v) $childrens[] = self::h('input', ['type'=>'hidden', 'name'=>$k, 'value'=>$v]);
 		if (!empty($params['fields'])) {
 			foreach ($params['fields'] as $fieldParams) {
-				$fields[] = self::h('input', $fieldParams);
+				$childrens[] = self::h('input', $fieldParams);
 			}
 		}
-		$fields[] = self::h('button', [
+		$childrens[] = self::h('button', [
 			'type'=>'submit',
 			'class' => 'btn ' . V::get('class', 'btn-default', $params),
 			'style' => V::get('style', '', $params)
@@ -311,7 +310,7 @@ class UI {
 				'style' => V::get('form.style', 'display:inline', $params),
 				'class' => "form-inline"
 			],
-			$fields
+			$childrens
 		);
 	}