public function __construct($attrs = null) { $default_attrs = array('cols' => '40', 'rows' => '10'); if (!is_null($attrs)) { $default_attrs = array_merge($default_attrs, $attrs); } parent::__construct($default_attrs); }
/** * Creates a select widget. * * @param array $attrs The attributes to use when rendering the widget. * @param array $choices The choices to use for select options. * * @return null */ public function __construct($attrs = null, $choices = null) { /** * Run default widget constructor. */ parent::__construct($attrs); /** * Initialize choices array if not given. */ if (is_null($choices)) { $choices = array(); } /** * Store widget choices. */ $this->choices = $choices; }
/** * Returns the value of this widget determined by the data and name. * * @return mixed */ public function valueFromData($data, $files, $name) { if (!array_key_exists($name, $data)) { return false; } return parent::valueFromData($data, $files, $name); }