/** * Parse all the default and required attributes that are used within the input field. * * @access protected * @param array $defaults * @param array $attributes * @return array */ protected function _prepareInput(array $defaults = array(), array $attributes = array()) { $attributes = array_merge($defaults, $attributes); $input = $attributes['name']; if ($this->_model != 'Form') { $attributes['name'] = $this->_model . '.' . $attributes['name']; } $nameParts = explode('.', $attributes['name']); $name = array_shift($nameParts); if (!empty($nameParts)) { foreach ($nameParts as $part) { $name .= '[' . $part . ']'; } } $attributes['name'] = $name; foreach (array('disabled', 'readonly', 'multiple') as $attr) { if (isset($attributes[$attr])) { if ($attributes[$attr] === true || $attributes[$attr] == $attr) { $attributes[$attr] = $attr; } unset($attributes[$attr]); } } $attributes = array_merge(array('id' => $this->_model . Inflector::camelize(str_replace('.', ' ', $input)), 'value' => $this->value($this->_model, $input)), $attributes); return $attributes; }