1: <?php
2:
3: /**
4: * Papi type that handle option, option data
5: * and rendering. All option types should extend this
6: * class.
7: */
8: class Papi_Option_Type extends Papi_Page_Type {
9:
10: /**
11: * The method name to use instead of `page_type`.
12: *
13: * @var string
14: */
15: public $_meta_method = 'option_type';
16:
17: /**
18: * Capability.
19: *
20: * @var array
21: */
22: public $capability = 'manage_options';
23:
24: /**
25: * The menu to register the option type on.
26: *
27: * @var string
28: */
29: public $menu = '';
30:
31: /**
32: * The name of the option type.
33: *
34: * @var string
35: */
36: public $name = '';
37:
38: /**
39: * The fake post type to use.
40: *
41: * @var string
42: */
43: public $post_type = '_papi_option_type';
44:
45: /**
46: * Get post type.
47: *
48: * @return string
49: */
50: public function get_post_type() {
51: return $this->post_type[0];
52: }
53:
54: /**
55: * Render option page type.
56: */
57: public function render() {
58: ?>
59: <div class="wrap">
60: <h2><?php echo esc_html( $this->name ); ?></h2>
61: <form id="post" method="post" name="post">
62: <div id="papi-hidden-editor" class="hide-if-js">
63: <?php wp_nonce_field( 'papi_save_data', 'papi_meta_nonce' ); ?>
64: <?php wp_editor( '', 'papiHiddenEditor' ); ?>
65: </div>
66: <div id="poststuff">
67: <div id="post-body">
68: <?php
69: do_meta_boxes(
70: $this->post_type[0],
71: 'normal',
72: null
73: );
74: ?>
75: <?php submit_button(); ?>
76: </div>
77: </div>
78: </form>
79: </div>
80: <?php
81: }
82: }
83: