Form::add_field( string $path, mixed $val )
Description #
Add new field in form.
Parameters #
- $pathstring (Required) Path of new array item. This must include field name at last.
- $valmixed (Required) Value to set.
Source #
File: lib/class-form.php
public function add_field( $path, $val ) {
$path = is_string( $path ) ? explode( '.', $path ) : $path;
$loc = &$this->args['fields'];
foreach ( (array) $path as $step ) {
$loc = &$loc[ $step ]['fields'];
}
$loc['fields'] = $val;
}
Expand full source code Collapse full source code View on GitHub: lib/class-form.php:391
Add your comment