-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Stellar Sale Banner and Logic #2095
Conversation
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.
Looks good! Approving with optional suggestion
// Determine the copy based on the active plugins. | ||
$has_events_calendar_pro = $dependency->is_plugin_active( 'Tribe__Events__Pro__Main' ); | ||
$has_event_tickets_plus = $dependency->is_plugin_active( 'Tribe__Tickets_Plus__Main' ); | ||
|
||
if ( $has_events_calendar_pro && ! $has_event_tickets_plus ) { | ||
$template_args['sub_heading'] = __( 'Save 40% on Filter Bar.', 'tribe-common' ); | ||
$template_args['stellar_copy'] = __( 'Add filters to your calendar during the annual Stellar Sale. Now through July 30.', 'tribe-common' ); | ||
} elseif ( $has_event_tickets_plus && ! $has_events_calendar_pro ) { | ||
$template_args['sub_heading'] = __( 'Save 40% on The Events Calendar Bundles.', 'tribe-common' ); | ||
$template_args['stellar_copy'] = __( 'Take <b>40%</b> off when you upgrade to a bundle during the annual Stellar Sale. Now through July 30.', 'tribe-common' ); | ||
} else { | ||
$template_args['heading'] = __( 'Make it stellar.', 'tribe-common' ); | ||
$template_args['sub_heading'] = __( 'Save 40% on all StellarWP products.', 'tribe-common' ); | ||
$template_args['stellar_copy'] = __( 'Take <b>40%</b> off all brands during the annual Stellar Sale. Now through July 30.', 'tribe-common' ); | ||
} | ||
} |
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.
Completely optional and up to you. - Could we refactor this whole if - elseif - else to early return instead ?
e.g.
if ( ! $dependency->has_active_premium_plugin() ) {
return $this->get_template()->template( 'notices/tribe-stellar-sale', $template_args, false );
}
if ( $has_events_calendar_pro && $has_event_tickets_plus ) {
// $template_args[]...
return;
}
if ( ! $has_events_calendar_pro ) {
return;
}
// has only ECP
return;
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.
We don't want to return, because we are passing the template args into the template on line 87.
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.
We would be returning the template in every scenario, in that case, repeating the same line of code over and over.
π« Ticket
ET-2113
ποΈ Description
Updated the banner for the 2024 Stellar Sale.
π₯ Artifacts
βοΈ Checklist
readme.txt
file.wpunit
orintegration
tests.wpunit
orintegration
tests.