attrs = $attrs; } /** * Renders the HTML of the input. * * @param string Name of the field. * @param mixed Value for the field, can be a non valid value. * @param array Extra attributes to add to the input form (array()) * @return string The HTML string of the input. */ public function render($name, $value, $extra_attrs=array()) { throw new Exception('Not Implemented.'); } /** * Build the list of attributes for the form. * It should be called this way: * $this->buildAttrs(array('name'=>$name, 'type'=>$this->input_type), * $extra_attrs); * * @param array Contains the name and type attributes. * @param array Extra attributes, like 'class' for example. * @return array The attributes for the field. */ protected function buildAttrs($attrs, $extra_attrs=array()) { return array_merge($this->attrs, $attrs, $extra_attrs); } /** * A widget can split itself in multiple input form. For example * you can have a datetime value in your model and you use 2 * inputs one for the date and one for the time to input the * value. So the widget must know how to get back the values from * the submitted form. * * @param string Name of the form. * @param array Submitted form data. * @return mixed Value or null if not defined. */ public function valueFromFormData($name, $data) { if (isset($data[$name])) { return $data[$name]; } return null; } /** * Returns the HTML ID attribute of this Widget for use by a *