clonefish elements
clonefish element class
methods
All the element types are subclasses of the element class. The public methods of the elements are generalized. You can reach an element with the getElementByName() method of clonefish:
$element = $clonefish->getElementByName('name');
The properties of the elements are set through the configuration array, instead of being set directly. The configuration array settings are described under the "Input types" and the "Validation types" section.
The public methods of the element classes are:
-
$element->setvalue( $value, $slashes_already_added );
Sets the value of an element. The value is not a reference but a copy.
The second parameter is used to enable/disablestripslashes()on the array items given in the second parameter. The concept is, that in Clonefish there should be no magic slashed data: you have to tell Clonefish whether the values passed are 'magically quoted', or not. If you'd like to read more on handling quotes, see the Features section! -
$value = $element->getvalue( $addslashes );
Returns the value of the element.
The only parameter it accepts is$addslasheswhich is used to add slashes (eg. for database queries) on the value. To read more on handling quotes, see the Features section!
By default, it returns the value for a simple field (like an inputText). It might return also:- NULL for empty arrays,
- if it's an array with only one array element, it returns that array element (not in an array)
- if the array has more than one elements, it returns the array
-
echo $element->gettype($value);
Returns the class name of an element
-
echo $element->getvaluearray($value);
Returns an array for a select, selectDynamic, or a selectFile, even if the select is a single select or a multiple select with only one option selected.
