$t->is($f->getWidgetSchema()->getFormFormatterName(), 'table', 'renderUsing() does not persist form formatter name for the current form instance'); $w = $f->getWidgetSchema(); $w->addFormFormatter('custom', new sfWidgetFormSchemaFormatterList($w)); $t->is($f->renderUsing('custom'), fix_linebreaks($output), 'renderUsing() renders a custom form formatter'); try { $f->renderUsing('nonexistant'); $t->fail('renderUsing() throws an exception if formatter name does not exist'); } catch (InvalidArgumentException $e) { $t->pass('renderUsing() throws an exception if formatter name does not exist'); } // renderHiddenFields() $t->diag('->renderHiddenFields()'); $f = new sfForm(); $f->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'name' => new sfWidgetFormInputText(), 'is_admin' => new sfWidgetFormInputHidden())); $output = '<input type="hidden" name="id" id="id" /><input type="hidden" name="is_admin" id="is_admin" />'; $t->is($f->renderHiddenFields(), $output, 'renderHiddenFields() renders all hidden fields, no visible fields'); $t->is(count($f->getFormFieldSchema()), 3, 'renderHiddenFields() does not modify the form fields'); $author = new sfForm(); $author->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'name' => new sfWidgetFormInputText())); $company = new sfForm(); $company->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'name' => new sfWidgetFormInputText())); $author->embedForm('company', $company); $output = '<input type="hidden" name="id" id="id" /><input type="hidden" name="company[id]" id="company_id" />'; $t->is($author->renderHiddenFields(), $output, 'renderHiddenFields() renders hidden fields from embedded forms'); $output = '<input type="hidden" name="id" id="id" />'; $t->is($author->renderHiddenFields(false), $output, 'renderHiddenFields() does not render hidden fields from embedded forms if the first parameter is "false"'); // ->embedForm() $t->diag('->embedForm()'); $author = new FormTest(array('first_name' => 'Fabien')); $author->setWidgetSchema($author_widget_schema = new sfWidgetFormSchema(array('first_name' => new sfWidgetFormInputText()))); $author->setValidatorSchema($author_validator_schema = new sfValidatorSchema(array('first_name' => new sfValidatorString(array('min_length' => 2)))));
} else { echo button_to(__('Generate consumer secret'), '@op_opensocial_update_consumer_secret?id=' . $application->getId()); } ?> </td></tr> <tr><th>Signature method</th><td>HMAC-SHA1</td></tr> <tr><td colspan="2"> <?php echo button_to(__('Delete'), '@op_opensocial_delete?id=' . $sf_request->getParameter('id'), array('style' => 'float:left')); ?> <?php $form = new sfForm(); echo $form->renderFormTag(url_for('@op_opensocial_update?id=' . $sf_request->getParameter('id')), array('style' => 'float:left')); echo $form->renderHiddenFields(); ?> <input type="submit" value="<?php echo __('Update'); ?> " /> </form> <?php if ($application->isActive()) { echo $form->renderFormTag(url_for('@op_opensocial_inactivate?id=' . $sf_request->getParameter('id'))); echo $form->renderHiddenFields(); ?> <input type="submit" value="<?php echo __('Inactivate'); ?> " />