classes/Input/Search.php
public function longhand($config)
    {
        $search = [];
        foreach ($config as $key => $val) {

            // Make locale menu
            if ($val == 'locale') {
                $search['locale'] = [
                    'type' => 'select',
                    'label' => 'Locale',
                    'options' => Config::get('decoy.site.locales'),
                ];

            // Not associative assume it's a text field
            } elseif (is_numeric($key)) {
                $search[$val] = ['type' => 'text', 'label' => Text::titleFromKey($val)];

            // If value isn't an array, make a default label
            } elseif (!is_array($val)) {
                $search[$key] = ['type' => $val, 'label' => Text::titleFromKey($key)];

            // Add the meta array
            } else {

                // Make a default label
                if (empty($val['label'])) {
                    $val['label'] = Text::titleFromKey($key);
                }

                // Support class static method or variable as options for a select
                if (!empty($val['type'])
                    && $val['type'] == 'select'
                    && !empty($val['options'])
                    && is_string($val['options'])) {
                    $val['options'] = $this->longhandOptions($val['options']);
                }

                // Apply the meta data
                $search[$key] = $val;
            }
        }

        return $search;
    }
public function longhand($config)
    {
        $search = [];
        foreach ($config as $key => $val) {

            // Make locale menu
            if ($val == 'locale') {
                $search['locale'] = [
                    'type' => 'select',
                    'label' => 'Locale',
                    'options' => Config::get('decoy.site.locales'),
                ];

            // Not associative assume it's a text field
            } elseif (is_numeric($key)) {
                $search[$val] = ['type' => 'text', 'label' => Text::titleFromKey($val)];

            // If value isn't an array, make a default label
            } elseif (!is_array($val)) {
                $search[$key] = ['type' => $val, 'label' => Text::titleFromKey($key)];

            // Add the meta array
            } else {

                // Make a default label
                if (empty($val['label'])) {
                    $val['label'] = Text::titleFromKey($key);
                }

                // Support class static method or variable as options for a select
                if (!empty($val['type'])
                    && $val['type'] == 'select'
                    && !empty($val['options'])
                    && is_string($val['options'])) {
                    $val['options'] = $this->longhandOptions($val['options']);
                }

                // Apply the meta data
                $search[$key] = $val;
            }
        }

        return $search;
    }
public function longhand ( $ config ) { $ search = [ ] ; foreach ( $ config as $ key => $ val ) { // Make locale menu if ( $ val == 'locale' ) { $ search [ 'locale' ] = [ 'type' => 'select' , 'label' => 'Locale' , 'options' => Config :: get ( 'decoy.site.locales' ) , ] ; // Not associative assume it's a text field } elseif ( is_numeric ( $ key ) ) { $ search [ $ val ] = [ 'type' => 'text' , 'label' => Text :: titleFromKey ( $ val ) ] ; // If value isn't an array, make a default label } elseif ( ! is_array ( $ val ) ) { $ search [ $ key ] = [ 'type' => $ val , 'label' => Text :: titleFromKey ( $ key ) ] ; // Add the meta array } else { // Make a default label if ( empty ( $ val [ 'label' ] ) ) { $ val [ 'label' ] = Text :: titleFromKey ( $ key ) ; } // Support class static method or variable as options for a select if ( ! empty ( $ val [ 'type' ] ) && $ val [ 'type' ] == 'select' && ! empty ( $ val [ 'options' ] ) && is_string ( $ val [ 'options' ] ) ) { $ val [ 'options' ] = $ this -> longhandOptions ( $ val [ 'options' ] ) ; } // Apply the meta data $ search [ $ key ] = $ val ; } } return $ search ; }
Make the shorthand options of the search config explicit

@param  array $config Search config from the controller class definition
@return array
Make the shorthand options of the search config explicit