| | 730 | |
|---|
| | 731 | // }}} |
|---|
| | 732 | // {{{ addOptionalElement() |
|---|
| | 733 | |
|---|
| | 734 | /** |
|---|
| | 735 | * Adds an optional element, using a checkbox |
|---|
| | 736 | * @param array $elements array of elements composing the group |
|---|
| | 737 | * @param string $name (optional)group name |
|---|
| | 738 | * @param string $groupLabel (optional)group label |
|---|
| | 739 | * @param string $separator (optional)string to separate elements |
|---|
| | 740 | * @param string $appendName (optional)specify whether the group name should be |
|---|
| | 741 | * used in the form element name ex: group[element] |
|---|
| | 742 | * @return object reference to added group of elements |
|---|
| | 743 | * @since 2.8 |
|---|
| | 744 | * @access public |
|---|
| | 745 | * @throws PEAR_Error |
|---|
| | 746 | */ |
|---|
| | 747 | function &addOptionalElement($element, $name, $standardValue, $groupLabel /*, optional multiple params.. */) |
|---|
| | 748 | { |
|---|
| | 749 | if (is_object($element) && is_subclass_of($element, 'html_quickform_element')) { |
|---|
| | 750 | $elementObject = &$element; |
|---|
| | 751 | } else { |
|---|
| | 752 | // get arguments for elementObject |
|---|
| | 753 | $args = array_slice(func_get_args(),3); |
|---|
| | 754 | array_unshift($args, null); // stick null on the beginning (element name) |
|---|
| | 755 | |
|---|
| | 756 | $elementObject =& $this->_loadElement('addElement', $element, $args); |
|---|
| | 757 | if (PEAR::isError($elementObject)) { |
|---|
| | 758 | return $elementObject; |
|---|
| | 759 | } |
|---|
| | 760 | } |
|---|
| | 761 | |
|---|
| | 762 | $group =& $this->addElement('optionalgroup', $standardValue, $name, $groupLabel, $elementObject); |
|---|
| | 763 | return $group; |
|---|
| | 764 | |
|---|
| | 765 | } // end func addOptionalElement2 |
|---|