1 | <?php |
||
23 | class Attachment_Model extends Post_Model { |
||
24 | |||
25 | /** |
||
26 | * Définition du modèle principal des attachements |
||
27 | * |
||
28 | * @var array Les champs principaux des attachements |
||
29 | */ |
||
30 | protected $schema = array(); |
||
31 | |||
32 | /** |
||
33 | * Défini le schéma de WP_Post de type attachment. |
||
34 | * |
||
35 | * @since 0.1.0 |
||
36 | * @version 1.0.0 |
||
37 | * |
||
38 | * @param array $data Data. |
||
39 | * @param mixed $req_method Peut être "GET", "POST", "PUT" ou null. |
||
40 | */ |
||
41 | public function __construct( $data = null, $req_method = null ) { |
||
42 | $this->schema['mime_type'] = array( |
||
43 | 'type' => 'string', |
||
44 | 'field' => 'post_mime_type', |
||
45 | 'context' => array( 'GET' ), |
||
46 | ); |
||
47 | |||
48 | $this->schema['_wp_attached_file'] = array( |
||
49 | 'type' => 'string', |
||
50 | 'meta_type' => 'single', |
||
51 | 'field' => '_wp_attached_file', |
||
52 | ); |
||
53 | |||
54 | $this->schema['taxonomy'] = array( |
||
55 | 'type' => 'array', |
||
56 | 'meta_type' => 'multiple', |
||
57 | 'child' => array( |
||
58 | Attachment_Class::g()->get_attached_taxonomy() => array( |
||
59 | 'meta_type' => 'multiple', |
||
60 | 'array_type' => 'integer', |
||
61 | 'type' => 'array', |
||
62 | ), |
||
63 | ), |
||
64 | ); |
||
65 | |||
66 | parent::__construct( $data, $req_method ); |
||
67 | } |
||
68 | } |
||
69 | } // End if(). |
||
70 |