public static function optionsArrayInput($data)
    {
        // seems to be a two way data binind, thefore direct return the string and do not transform.
        if (is_scalar($data)) {
            return $data;
        }
        
        $output = [];
        
        foreach ($data as $value => $label) {
            if (is_array($label)) {
                if (!isset($label['label']) || !isset($label['value'])) {
                    throw new InvalidConfigException("The options array data for the given element must contain a label and value key.");
                }
                
                $output[] = $label;
            } else {
                $output[] = ['label' => $label, 'value' => $value];
            }
        }
        
        return $output;
    }