Development

#6065 ([1.3] [Admin Generator] Add a way to pass form options to the getForm() method of [Module]GeneratorConfiguration class)

You must first sign up to be able to contribute.

Ticket #6065 (closed enhancement: fixed)

Opened 1 year ago

Last modified 4 months ago

[1.3] [Admin Generator] Add a way to pass form options to the getForm() method of [Module]GeneratorConfiguration class

Reported by: hugo.hamon Assigned to: fabien
Priority: minor Milestone: 1.3.0 beta1
Component: generator Version:
Keywords: Cc:
Qualification: Unreviewed

Description

For now, the new admin generator generates a getForm() method in the base class Base[Module]GeneratorConfiguration. The generated method looks like the following one :

public function getForm($object = null) {

$class = $this->getFormClass();

return new $class($object, $this->getFormOptions());

}

But there is a problem with it ! It's not possible to pass extra options to the form to initialize it. For example, when we need to use a sfWidgetFormJQueryAutocompleter widget, we must pass it the generated URI that the ajax call has to request.

So, currently the solution is to override the getForm() inside the [Module]GeneratorConfiguration class in order to pass a second extra argument of options that will be merged with the returned array of $this->getFormOptions().

The given patch provides this small improvment for both doctrine and propel generators.

Attachments

patch_sf_1-3_AdminGen_getForm_method.patch (1.6 kB) - added by hugo.hamon on 03/11/09 15:55:33.
Patch to improve the getForm() method in order to pass extra options arguments to the form

Change History

03/11/09 15:55:33 changed by hugo.hamon

  • attachment patch_sf_1-3_AdminGen_getForm_method.patch added.

Patch to improve the getForm() method in order to pass extra options arguments to the form

03/11/09 15:56:45 changed by hugo.hamon

  • type changed from defect to enhancement.

Changed ticket type to enhancement

10/13/09 12:59:49 changed by Kris.Wallsmith

  • milestone changed from 1.3.0 alpha2 to 1.3.0 beta1.

10/19/09 16:52:33 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [23187]) [1.3] added a way to pass form options to the getForm() method of [Module]GeneratorConfiguration? class (closes #6065)

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.