[Pieforms-commit] SF.net SVN: pieforms: [165] pieforms-php5/trunk/src/pieform.php
Status: Alpha
Brought to you by:
oracleshinoda
|
From: <ora...@us...> - 2007-01-11 09:42:13
|
Revision: 165
http://svn.sourceforge.net/pieforms/?rev=165&view=rev
Author: oracleshinoda
Date: 2007-01-11 01:42:12 -0800 (Thu, 11 Jan 2007)
Log Message:
-----------
Added 'elementclasses' option - if set, then each element is given a class matching the type of element that it is
Modified Paths:
--------------
pieforms-php5/trunk/src/pieform.php
Modified: pieforms-php5/trunk/src/pieform.php
===================================================================
--- pieforms-php5/trunk/src/pieform.php 2007-01-07 21:12:16 UTC (rev 164)
+++ pieforms-php5/trunk/src/pieform.php 2007-01-11 09:42:12 UTC (rev 165)
@@ -285,7 +285,10 @@
'rulei18n' => array(),
// The tabindex for the form (managed automatically by Pieforms)
- 'tabindex' => false
+ 'tabindex' => false,
+
+ // Whether to add a class of the type of the element to each element
+ 'elementclasses' => false
);
$data = array_merge($formdefaults, $formconfig, $data);
$this->data = $data;
@@ -1049,7 +1052,7 @@
* @param array $element The element to make an ID for
* @return string The ID for the element
*/
- public static function make_id($element) {
+ public function make_id($element) {
if (isset($element['id'])) {
return self::hsc($element['id']);
}
@@ -1071,7 +1074,7 @@
* @param array $element The element to make a class for
* @return string The class for an element
*/
- public static function make_class($element) {
+ public function make_class($element) {
$classes = array();
if (isset($element['class'])) {
$classes[] = $element['class'];
@@ -1082,6 +1085,9 @@
if (!empty($element['error'])) {
$classes[] = 'error';
}
+ if ($this->data['elementclasses']) {
+ $classes[] = $element['type'];
+ }
// Please make sure that 'autofocus' is the last class added in this
// method. Otherwise, improve the logic for removing 'autofocus' from
// the elemnt class string in pieform_render_element
@@ -1336,8 +1342,8 @@
throw new PieformException('No such form renderer function: "' . $rendererfunction . '"');
}
- $element['id'] = Pieform::make_id($element);
- $element['class'] = Pieform::make_class($element);
+ $element['id'] = $form->make_id($element);
+ $element['class'] = $form->make_class($element);
$builtelement = $function($form, $element);
// Remove the 'autofocus' class, because we only want it on the form input
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|