$v){
if(!is_array($v)){
$html.=$k.'="'.$v.'" ';
}
}
if($data_attributes && $data_attributes !== null && is_array($data_attributes)){
foreach($data_attributes as $k => $v){
if(!is_array($v)){
$html.='data-'.$k.'="'.$v.'" ';
}
}
}
return $html;
};
/**
* @name build_selector
* Creates a html select element with options, optgroups. It marks the selected element or if
* selected element is not presented, the first element.
* @param array $options Source for options and optgroups
* Format:
* options:
* - value => option
* groups:
* - group => array( 'groupname', array( //options )
* @param null $attributes Source for attributes
* @param null $selected Value of the selected option
* @throws Exception
*/
function build_selector($options = array(),$attributes = null,$selected = null){
$options = (!empty($options) && is_array($options)) ? $options : false;
$selected = ($selected !== null && !empty($selected) && !is_array($selected)) ? $selected : false;
$attributes = (!empty($attributes) && is_array($attributes)) ? $attributes : false;
$data_attributes = (array_key_exists('data-',$attributes) && (!empty($attributes['data-']))) ? $attributes['data-'] : false;
$html_wrapper = '