Hi,

I wrote a function that I use quiet often. It displays the php code to
decompose a form.
It might help with the embed form, the i18n and the hidden field :

class myTools{

  public static function getFormFields( $form )
  {
    self::__getFormFields($form);
  }

  private static function __getFormFields( $form, $indent = 0, $embed
= '' ) {
    if( get_class($form) == 'sfFormFieldSchema' ) {
      $schema = $form;
    }else {
      $schema = $form->getFormFieldSchema();
    }

    foreach( $schema as $key=>$form_field ) {
      if( get_class($form_field) != 'sfFormFieldSchema' ) {
        if( $form_field->isHidden() ) {
          echo htmlentities('<?php echo $form'.$embed.'[\''.$key.'\']-
>render(); ?>').'<br />';
        }else {
          echo htmlentities('<?php echo $form'.$embed.'[\''.$key.'\']-
>renderRow(); ?>').'<br />';
        }
      }else {
        $key = ($key == sfContext::getInstance()->getUser()->getCulture
()) ?  '$sf_user->getCulture()' : "'".$key."'";
        self::__getFormFields($form_field, $indent+1, $embed.'['.
$key.']');
      }
    }
  }
}

and then
myTools::getFormFields($form);

Antoine
doubleclique.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to