[Pieforms-commit] SF.net SVN: pieforms: [69] pieforms-php5/trunk/src/pieform.php
Status: Alpha
Brought to you by:
oracleshinoda
|
From: <ora...@us...> - 2006-11-23 10:41:27
|
Revision: 69
http://svn.sourceforge.net/pieforms/?rev=69&view=rev
Author: oracleshinoda
Date: 2006-11-23 02:41:27 -0800 (Thu, 23 Nov 2006)
Log Message:
-----------
Implemented ignoring properly, unsetting the elements while going around the default setting loop wasn't working properly
Modified Paths:
--------------
pieforms-php5/trunk/src/pieform.php
Modified: pieforms-php5/trunk/src/pieform.php
===================================================================
--- pieforms-php5/trunk/src/pieform.php 2006-11-23 01:06:00 UTC (rev 68)
+++ pieforms-php5/trunk/src/pieform.php 2006-11-23 10:41:27 UTC (rev 69)
@@ -397,15 +397,28 @@
if (!is_array($data['elements']) || count($data['elements']) == 0) {
throw new PieformException('Forms must have a list of elements');
}
+
+ // Remove elements to ignore
+ foreach ($data['elements'] as $name => $element) {
+ if (isset($element['type']) && $element['type'] == 'fieldset') {
+ foreach ($element['elements'] as $subname => $subelement) {
+ if (!empty($subelement['ignore'])) {
+ unset ($data['elements'][$name]['elements'][$subname]);
+ }
+ }
+ }
+ else {
+ if (!empty($element['ignore'])) {
+ unset($data['elements'][$name]);
+ }
+ }
+ }
+
$this->elements = $data['elements'];
// Set some attributes for all elements
$autofocusadded = false;
foreach ($this->elements as $name => &$element) {
- if (!empty($element['ignore'])) {
- unset($this->elements[$name]);
- continue;
- }
// The name can be in the element itself. This is compatibility for the perl version
if (isset($element['name'])) {
$name = $element['name'];
@@ -432,10 +445,6 @@
}
if ($element['type'] == 'fieldset') {
foreach ($element['elements'] as $subname => &$subelement) {
- if (!empty($subelement['ignore'])) {
- unset($element['elements'][$subname]);
- continue;
- }
// The name can be in the element itself. This is compatibility for the perl version
if (isset($subelement['name'])) {
$subname = $subelement['name'];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|