1 | <?php |
||
10 | class Widget_Container extends Container { |
||
11 | |||
12 | /** |
||
13 | * Create a new widget |
||
14 | * |
||
15 | * @param string $unique_id Unique ID of the widget |
||
16 | * @param string $title Ignored |
||
17 | * @param string $type Container type |
||
18 | **/ |
||
19 | public function __construct( $unique_id, $title, $type ) { |
||
20 | $this->id = $unique_id; |
||
21 | $this->title = ''; |
||
22 | $this->type = $type; |
||
23 | |||
24 | $this->condition_collection = App::resolve( 'container_condition_fulfillable_collection' ); |
||
25 | $this->condition_collection->set_condition_type_list( |
||
26 | array_merge( $this->get_condition_types( true ), $this->get_condition_types( false ) ), |
||
27 | true |
||
28 | ); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Perform instance initialization |
||
33 | **/ |
||
34 | public function init() { |
||
40 | |||
41 | /** |
||
42 | * Get environment array for page request (in admin) |
||
43 | * |
||
44 | * @return array |
||
45 | **/ |
||
46 | protected function get_environment_for_request() { |
||
47 | return array(); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Perform checks whether the container should be attached during the current request |
||
52 | * |
||
53 | * @return bool True if the container is allowed to be attached |
||
54 | **/ |
||
55 | public function is_valid_attach_for_request() { |
||
67 | |||
68 | /** |
||
69 | * Get environment array for object id |
||
70 | * |
||
71 | * @return array |
||
72 | */ |
||
73 | protected function get_environment_for_object( $object_id ) { |
||
74 | return array(); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Check container attachment rules against object id |
||
79 | * |
||
80 | * @param int $object_id |
||
81 | * @return bool |
||
82 | **/ |
||
83 | public function is_valid_attach_for_object( $object_id = null ) { |
||
86 | |||
87 | /* Checks whether the current save request is valid |
||
88 | * |
||
89 | * @return bool |
||
90 | **/ |
||
91 | public function is_valid_save( $object_id = 0 ) { |
||
97 | |||
98 | /** |
||
99 | * Output the container markup |
||
100 | **/ |
||
101 | public function render() { |
||
104 | |||
105 | /** |
||
106 | * Returns an array that holds the container data, suitable for JSON representation. |
||
107 | * This data will be available in the Underscore template and the Backbone Model. |
||
108 | * |
||
109 | * @param bool $load Should the value be loaded from the database or use the value from the current instance. |
||
110 | * @return array |
||
111 | */ |
||
112 | public function to_json( $load ) { |
||
115 | } |
||
116 | |||
117 |