WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
wpdk-custom-taxonomy.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * [DRAFT]
6  *
7  * THE FOLLOWING CODE IS A DRAFT. FEEL FREE TO USE IT TO MAKE SOME EXPERIMENTS, BUT DO NOT USE IT IN ANY CASE IN
8  * PRODUCTION ENVIRONMENT. ALL CLASSES AND RELATIVE METHODS BELOW CAN CHNAGE IN THE FUTURE RELEASES.
9  *
10  */
11 
23 class WPDKCustomTaxonomy extends WPDKObject {
24 
32  public $__version = '1.0.1';
33 
41  public $id = '';
42 
50  public $object_type;
51 
63  public function __construct( $id, $object_type, $args )
64  {
65  /* Save useful properties */
66  $this->id = $id;
67  $this->object_type = $object_type;
68 
69  /* @todo Do a several control check in the input $args array */
70 
71  /* Register the taxonomy. */
72  register_taxonomy( $id, $object_type, $args );
73 
74  /* Init admin hook */
75  $this->initAdminHook();
76  }
77 
83  private function initAdminHook()
84  {
85  if ( is_admin() ) {
86  /* Admin backend head area */
87  add_action( 'admin_print_styles-edit-tags.php', array( $this, 'admin_print_styles' ) );
88 
89  /* Current screen */
90  add_action( 'current_screen', array( $this, '_current_screen' ) );
91 
92  // do_action('after-' . $taxonomy . '-table', $taxonomy);
93  // do_action($taxonomy . '_pre_add_form', $taxonomy);
94 
95  }
96  }
97 
103  public function admin_print_styles()
104  {
105  /* Override */
106  }
107 
115  public function _current_screen( $screen )
116  {
117  if ( !empty( $screen->taxonomy ) && $screen->taxonomy == $this->id ) {
118  $this->admin_print_styles();
119  }
120  }
121 
122 }
123