| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Base class for admin views, enqueues admin files, has functions for displaying editable custom fields. |
| 5 |
* |
| 6 |
* @since 3.0.0 |
| 7 |
*/ |
| 8 |
class ewdotpViewAdmin extends ewdotpView { |
| 9 |
|
| 10 |
/** |
| 11 |
* Prints custom fields area |
| 12 |
* |
| 13 |
* @since 3.0.0 |
| 14 |
*/ |
| 15 |
public function print_admin_custom_field( $custom_field ) { |
| 16 |
global $ewd_otp_controller; |
| 17 |
|
| 18 |
$custom_field->field_value = $this->set_custom_field_value( $custom_field ); |
| 19 |
|
| 20 |
$this->custom_field = $custom_field; |
| 21 |
|
| 22 |
if ( $custom_field->type == 'text' ) { $template = $this->find_template( 'admin-custom-field-text' ); } |
| 23 |
elseif ( $custom_field->type == 'textarea' ) { $template = $this->find_template( 'admin-custom-field-textarea' ); } |
| 24 |
elseif ( $custom_field->type == 'number' ) { $template = $this->find_template( 'admin-custom-field-number' ); } |
| 25 |
elseif ( $custom_field->type == 'select' ) { $template = $this->find_template( 'admin-custom-field-select' ); } |
| 26 |
elseif ( $custom_field->type == 'radio' ) { $template = $this->find_template( 'admin-custom-field-radio' ); } |
| 27 |
elseif ( $custom_field->type == 'checkbox' ) { $template = $this->find_template( 'admin-custom-field-checkbox' ); } |
| 28 |
elseif ( $custom_field->type == 'link' ) { $template = $this->find_template( 'admin-custom-field-link' ); } |
| 29 |
elseif ( $custom_field->type == 'file' ) { $template = $this->find_template( 'admin-custom-field-file' ); } |
| 30 |
elseif ( $custom_field->type == 'image' ) { $template = $this->find_template( 'admin-custom-field-image' ); } |
| 31 |
elseif ( $custom_field->type == 'date' ) { $template = $this->find_template( 'admin-custom-field-date' ); } |
| 32 |
elseif ( $custom_field->type == 'datetime' ) { $template = $this->find_template( 'admin-custom-field-datetime' ); } |
| 33 |
|
| 34 |
if ( $template ) { |
| 35 |
include( $template ); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Returns the value for a specified custom field. Should be overwritten by child class. |
| 41 |
* |
| 42 |
* @since 3.0.0 |
| 43 |
*/ |
| 44 |
public function set_custom_field_value( $custom_field ) { |
| 45 |
|
| 46 |
return null; |
| 47 |
} |
| 48 |
} |
| 49 |
|