@@ 120-153 (lines=34) @@ | ||
117 | * @param array $instance The settings for this instance. |
|
118 | * @return void |
|
119 | */ |
|
120 | public function form( $instance ) { |
|
121 | ||
122 | /* Set up some default widget settings. */ |
|
123 | /* Make sure all keys are added here, even with empty string values. */ |
|
124 | $defaults = array( |
|
125 | 'title' => '', |
|
126 | 'component' => '', |
|
127 | 'limit' => 3 |
|
128 | ); |
|
129 | ||
130 | $instance = wp_parse_args( (array) $instance, $defaults ); |
|
131 | ?> |
|
132 | <!-- Widget Title: Text Input --> |
|
133 | <p> |
|
134 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
135 | <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
136 | </p> |
|
137 | <!-- Widget Component: Select Input --> |
|
138 | <p> |
|
139 | <label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label> |
|
140 | <select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"> |
|
141 | <?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?> |
|
142 | <option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option> |
|
143 | <?php } ?> |
|
144 | </select> |
|
145 | </p> |
|
146 | <!-- Widget Limit: Text Input --> |
|
147 | <p> |
|
148 | <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Lessons (optional):', 'woothemes-sensei' ); ?></label> |
|
149 | <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
150 | </p> |
|
151 | ||
152 | <?php |
|
153 | } // End form() |
|
154 | ||
155 | /** |
|
156 | * Load the desired component, if a method is available for it. |
@@ 135-168 (lines=34) @@ | ||
132 | * @param array $instance The settings for this instance. |
|
133 | * @return void |
|
134 | */ |
|
135 | public function form( $instance ) { |
|
136 | ||
137 | /* Set up some default widget settings. */ |
|
138 | /* Make sure all keys are added here, even with empty string values. */ |
|
139 | $defaults = array( |
|
140 | 'title' => '', |
|
141 | 'component' => '', |
|
142 | 'limit' => 3 |
|
143 | ); |
|
144 | ||
145 | $instance = wp_parse_args( (array) $instance, $defaults ); |
|
146 | ?> |
|
147 | <!-- Widget Title: Text Input --> |
|
148 | <p> |
|
149 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
150 | <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
151 | </p> |
|
152 | <!-- Widget Component: Select Input --> |
|
153 | <p> |
|
154 | <label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label> |
|
155 | <select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"> |
|
156 | <?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?> |
|
157 | <option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option> |
|
158 | <?php } ?> |
|
159 | </select> |
|
160 | </p> |
|
161 | <!-- Widget Limit: Text Input --> |
|
162 | <p> |
|
163 | <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label> |
|
164 | <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
165 | </p> |
|
166 | ||
167 | <?php |
|
168 | } // End form() |
|
169 | ||
170 | /** |
|
171 | * Load the desired component, if a method is available for it. |