Ok, I have the parent class from a plugin I'm trying to extend:
class OsBookingHelper {
public static function get_statuses_list(){
return array( LATEPOINT_BOOKING_STATUS_APPROVED => __('Approved', 'latepoint'),
LATEPOINT_BOOKING_STATUS_PENDING => __('Pending Approval', 'latepoint'),
LATEPOINT_BOOKING_STATUS_PAYMENT_PENDING => __('Payment Pending', 'latepoint'),
LATEPOINT_BOOKING_STATUS_CANCELLED => __('Cancelled', 'latepoint'));
}
}
My code to extend follows: It's not working for some reason....
if ( ! class_exists( 'OsNuuCustomAppointmentStatusHelper' ) ) :
class OsNuuCustomAppointmentStatusHelper extends OsBookingHelper {
function __construct(){
parent::__construct();
}
public static function get_statuses_list(){
return array( LATEPOINT_BOOKING_STATUS_APPROVED => __('Approved', 'latepoint'),
LATEPOINT_BOOKING_STATUS_PENDING => __('Pending Approval', 'latepoint'),
LATEPOINT_BOOKING_STATUS_PAYMENT_PENDING => __('Payment Pending', 'latepoint'),
LATEPOINT_BOOKING_STATUS_CANCELLED => __('Cancelled', 'latepoint'),
LATEPOINT_BOOKING_STATUS_COMPLETE => __('Complete', 'latepoint'));
}
endif;
Any ideas? I'm totally at a loss with this...
Oh, before I forget. There's a parent class that is instantiated in another file that calls the file containing my code using include_once
My Answer:
It looks like you are missing the closing brace for the if statement in your code. You need to add a closing brace before the endif statement. Here is the corrected code:
php
if ( ! class_exists( 'OsNuuCustomAppointmentStatusHelper' ) ) {
class OsNuuCustomAppointmentStatusHelper extends OsBookingHelper {
function __construct(){
parent::__construct();
}
public static function get_statuses_list(){
return array( LATEPOINT_BOOKING_STATUS_APPROVED => __('Approved', 'latepoint'),
LATEPOINT_BOOKING_STATUS_PENDING => __('Pending Approval', 'latepoint'),
LATEPOINT_BOOKING_STATUS_PAYMENT_PENDING => __('Payment Pending', 'latepoint'),
LATEPOINT_BOOKING_STATUS_CANCELLED => __('Cancelled', 'latepoint'),
LATEPOINT_BOOKING_STATUS_COMPLETE => __('Complete', 'latepoint'));
}
}
}
Make sure to add the closing brace before the endif statement and see if that resolves the issue.
Rate this post
5 of 5 based on 5250 votesComments