src/helpers/Angular.php
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;
    }
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;
    }
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 ; }
Ensures the input structure for optional data for selects, radios etc.

Following options are possible:

+ An array with key => values.
+ An array with a nested array ['label' => , 'value' => ] format.
+ A string, this can be used when two way data binding should be used instead of array genertion

@param array $data|string Key value Paring or an array with label and value key.
@return array
Ensures the input structure for optional data for selects radios etc .