protected function normalizeData($rawData)
    {
        $data = array();
        foreach ($rawData as $key => $value) {
            if (is_array($value)) {
                $item = array('text' => $key, 'children' => $this->normalizeData($rawData[$key]));
            } else {
                $item = array('id' => $key, 'text' => $value);
            }
            $data[] = $item;
        }
        return $data;
    }
protected function normalizeData($rawData)
    {
        $data = array();
        foreach ($rawData as $key => $value) {
            if (is_array($value)) {
                $item = array('text' => $key, 'children' => $this->normalizeData($rawData[$key]));
            } else {
                $item = array('id' => $key, 'text' => $value);
            }
            $data[] = $item;
        }
        return $data;
    }
protected function normalizeData ( $ rawData ) { $ data = array ( ) ; foreach ( $ rawData as $ key => $ value ) { if ( is_array ( $ value ) ) { $ item = array ( 'text' => $ key , 'children' => $ this -> normalizeData ( $ rawData [ $ key ] ) ) ; } else { $ item = array ( 'id' => $ key , 'text' => $ value ) ; } $ data [ ] = $ item ; } return $ data ; }
Normalized the given data into the format supported by select2.
@param array $rawData the raw data (key=>value).
@return array the normalized data.
@see http://ivaynberg.github.io/select2/
Normalized the given data into the format supported by select2 .