Controller::modify_switch_mode_button( WP_Post|int|string $post )
Modify the switch mode button to show a warning when the event is not properly saved yet.
Contents
Parameters
- $post
-
(WP_Post|int|string) (Required) The post object.
Return
(void)
Source
File: src/Events/Integrations/Plugins/Elementor/Controller.php
public function modify_switch_mode_button( $post ): void {
// Since this is a hook, we need to check if the post is an object.
if ( ! $post instanceof \WP_Post ) {
return;
}
if ( ! tribe_is_event( $post ) ) {
return;
}
$start_date = get_post_meta( $post->ID, '_EventStartDate', true );
$end_date = get_post_meta( $post->ID, '_EventEndDate', true );
if ( ! empty( $start_date ) && ! empty( $end_date ) ) {
return;
}
$this->get_template()->template( 'switch-warning', [ 'post' => $post ] );
}
Changelog
| Version | Description |
|---|---|
| 6.4.0 | Introduced. |