| 1 |
<?php |
| 2 |
|
| 3 |
namespace PXLBSAdminify\Inc; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
abstract class Base_Model extends Base_Data { |
| 10 |
|
| 11 |
protected function init( $data ) { |
| 12 |
$this->set( array_merge( $this->get_defaults(), $data ) ); |
| 13 |
} |
| 14 |
|
| 15 |
public function get_default_field( $field ) { |
| 16 |
$fields = $this->get_defaults(); |
| 17 |
return isset( $fields[ $field ] ) ? $fields[ $field ] : null; |
| 18 |
} |
| 19 |
|
| 20 |
public function __construct( $data ) { |
| 21 |
if ( $data ) { |
| 22 |
$this->init( $data ); |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
|