protected function _getProperties(array $args, array $propertyNames = array())
{
$method = isset($this->_formopen['method']) && $this->_formopen['method'] == 'get' ? $_GET : $_POST;
if (isset($args['name']) && (!isset($args['type']) || !in_array($args['type'], $this->_staticTypes))) {
$arrayStart = strpos($args['name'], '[');
if (!$arrayStart) {
if (isset($method[$args['name']])) {
$args['value'] = $method[$args['name']];
}
} else {
$name = $this->_indexDynamicArray($args['name']);
if (preg_match_all('/\\[(.*)\\]/', $name, $arrayIndex)) {
array_shift($arrayIndex);
//dump the 0 index element containing full match string
}
$name = substr($name, 0, $arrayStart);
if (isset($method[$name])) {
$args['value'] = $method[$name];
if (!isset($args['type']) || $args['type'] != 'checkbox') {
foreach ($arrayIndex as $idx) {
if (isset($args['value'][current($idx)])) {
$args['value'] = $args['value'][current($idx)];
} else {
unset($args['value']);
break;
}
}
}
}
}
}
$return = array();
$validProperties = array_merge($propertyNames, array('name', 'value', 'class', 'style', 'id'));
foreach ($validProperties as $propertyName) {
if (isset($args[$propertyName])) {
$return[$propertyName] = $args[$propertyName];
}
}
return $return;
}