Sunday, December 1, 2013

i18n & Tree problem

When trying to get language dependent values through javascript from a translated tree model I only get the tree spacers without the actual values.

In my controller I have:

          $modelObj = new $model_name();
          if($modelObj->actsAs[0] == 'Tree') {
               $optionslist = $modelObj->generateTreeList(null, null, null, TREE_SPACER_ADMIN_LISTING);
          } else {
               $optionslist = $modelObj->find('list');
          }
          $options = '';
          foreach($optionslist as $key => $value) {
               $options .= '<option value="' . $key . '">' . $value . '</option>';
          }
          echo $options;

This worked fine in my 1 language site but after changing to i18n the $value only holds the TREE_SPACER_ADMIN_LISTING without the actual $displayField value.
When used in combination with a NON-TREE-object it gives me a $displayfield value but not in the selected language

Can anyone tell me what to add to my code?  

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: