Index: trunk/extensions/DonationInterface/gateway_forms/Form.php |
— | — | @@ -61,6 +61,10 @@ |
62 | 62 | * add form-specific css - the path can be set in child classes |
63 | 63 | * using $this->setStylePath, which should be called before |
64 | 64 | * calling parent::__construct() |
| 65 | + * |
| 66 | + * @TODO ditch this and start using ResourceLoader. Perhaps do something |
| 67 | + * similar to how resources are getting loaded in TwoStepTwoColumn and |
| 68 | + * its children. |
65 | 69 | */ |
66 | 70 | if ( !strlen( $this->getStylePath() ) ) { |
67 | 71 | $this->setStylePath(); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumn.php |
— | — | @@ -4,9 +4,6 @@ |
5 | 5 | |
6 | 6 | public function __construct( &$gateway, &$form_errors ) { |
7 | 7 | parent::__construct( $gateway, $form_errors ); |
8 | | - // load validation and placeholder JS |
9 | | - $this->loadValidateJs(); |
10 | | - $this->loadPlaceholders(); |
11 | 8 | } |
12 | 9 | |
13 | 10 | public function loadPlaceholders() { |
— | — | @@ -21,6 +18,7 @@ |
22 | 19 | * @return string The entire form HTML |
23 | 20 | */ |
24 | 21 | public function getForm() { |
| 22 | + $this->loadResources(); |
25 | 23 | $form = $this->generateFormStart(); |
26 | 24 | $form .= $this->getCaptchaHTML(); |
27 | 25 | $form .= $this->generateFormSubmit(); |
— | — | @@ -28,6 +26,19 @@ |
29 | 27 | return $form; |
30 | 28 | } |
31 | 29 | |
| 30 | + /** |
| 31 | + * Load resources required by this form |
| 32 | + * |
| 33 | + * This will get called in getForm(). If getForm() is not defined in any |
| 34 | + * child classes, but child classes should not load the same resources |
| 35 | + * as are defined here, just overload this method in the child class |
| 36 | + * to define what (if any) resources ought to be loaded. |
| 37 | + */ |
| 38 | + public function loadResources() { |
| 39 | + $this->loadValidateJs(); |
| 40 | + $this->loadPlaceholders(); |
| 41 | + } |
| 42 | + |
32 | 43 | public function generateFormStart() { |
33 | 44 | $form = $this->generateBannerHeader(); |
34 | 45 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -12,6 +12,15 @@ |
13 | 13 | parent::__construct( $gateway, $form_errors ); |
14 | 14 | } |
15 | 15 | |
| 16 | + /** |
| 17 | + * Load resources required by this form |
| 18 | + * |
| 19 | + * @see parent::loadResources() |
| 20 | + */ |
| 21 | + public function loadResources() { |
| 22 | + $this->loadValidateJs(); |
| 23 | + } |
| 24 | + |
16 | 25 | public function loadPlaceholders() { |
17 | 26 | global $wgOut; |
18 | 27 | // form placeholder values |