-
Notifications
You must be signed in to change notification settings - Fork 21
allows overriding the controller names for which the stripe headers a… #3
Conversation
Thank you for your PR and suggestion. To be in the same "spirit" of the module, I'd rather a declaration like "public $controllers" or hooks "public $hooks". $orderPageNames = ['order', 'order-opc'];
Hook::exec('actionStripeDefineOrderPageNames', &$orderPageNames); What do you think about it ? |
@clotaire202 yeah, I like the idea, please check the new commit. Please note that I'm using (min) php7.0, therefore call time pass by reference is not allowed. Hence I'm merging the result of the hook with the base array. I'll squash the changes once we reach an agreement. |
@clotaire202 After thinking this through I've realized we can the array by reference by means of an intermediate array. I've updated the PR accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you
stripe_official.php
Outdated
@@ -1058,7 +1058,12 @@ public function hookDisplayAdminOrderContentOrder($params) | |||
*/ | |||
public function hookHeader() | |||
{ | |||
if (!in_array($this->context->controller->php_self, ['order', 'order-opc'])) { | |||
$orderPages = ['order', 'order-opc']; | |||
$extraOrderPages = Hook::exec('actionStripeDefineOrderPageNames'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two theoretical problems:
- if you have two modules hook the last will override previous values
- if someone want to unset an orderPage previously added, the hook cannot manage this case
$orderPages = [
'order',
'order-opc',
];
Hook::exec('actionStripeDefineOrderPageNames', [ 'orderPages' => &$orderPages ]);
And to call this hook :
public function hookActionStripeDefineOrderPageNames($params)
{
$extraOrderPages = [
'my-order',
];
$params['orderPages'] = array_merge($params['orderPages'], $extraOrderPages);
}
…re sent. This eases integrating stripe with 3rd party one page checkout modules.
I've squashed the changes a single commit. |
Thank you for your contribution. I've just merged your PR in develop branch. |
allows overriding the controller names for which the stripe headers are sent.
This eases integrating stripe with 3rd party one page checkout modules.