/** * Overload get_name to optionally add a key index to the result. */ function get_name($key = false) { $name = parent::get_name(); if (!empty($key)) { $name .= "[{$key}]"; } return esc_attr($name); }
function WCB_Radio_Option($args) { parent::WCB_Option($args); $defaults = array('label' => '', 'values' => array()); extract(wp_parse_args($args, $defaults)); $this->label = $label; $this->values = $values; if (empty($values)) { return; } if (empty($this->default) || !array_key_exists($this->default, $this->values)) { $this->default = @$this->values[0]; } }