Skip to content

Commit 6a647bf

Browse files
committed
doc the scbWidget class
1 parent e570a2e commit 6a647bf

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

Widget.php

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
<?php
2-
3-
// Adds compatibility methods between WP_Widget and scbForms
4-
2+
/**
3+
* Adds compatibility methods between WP_Widget and scbForms.
4+
*/
55
abstract class scbWidget extends WP_Widget {
6+
7+
/**
8+
* Widget defaults.
9+
* @var array
10+
*/
611
protected $defaults = array();
712

13+
/**
14+
* Widgets to register.
15+
* @var array
16+
*/
817
private static $scb_widgets = array();
918

19+
/**
20+
* Initializes widget.
21+
*
22+
* @param string $class
23+
* @param string $file (optional)
24+
* @param string $base (optional)
25+
*
26+
* @return void
27+
*/
1028
public static function init( $class, $file = '', $base = '' ) {
1129
self::$scb_widgets[] = $class;
1230

@@ -18,13 +36,25 @@ public static function init( $class, $file = '', $base = '' ) {
1836
}
1937
}
2038

39+
/**
40+
* Registers widgets.
41+
*
42+
* @return void
43+
*/
2144
public static function _scb_register() {
2245
foreach ( self::$scb_widgets as $widget ) {
2346
register_widget( $widget );
2447
}
2548
}
2649

27-
// A pre-filled method, for convenience
50+
/**
51+
* Displays widget content.
52+
*
53+
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
54+
* @param array $instance The settings for the particular instance of the widget.
55+
*
56+
* @return void
57+
*/
2858
public function widget( $args, $instance ) {
2959
$instance = wp_parse_args( $instance, $this->defaults );
3060

@@ -43,15 +73,27 @@ public function widget( $args, $instance ) {
4373
echo $after_widget;
4474
}
4575

46-
// This is where the actual widget content goes
76+
/**
77+
* This is where the actual widget content goes.
78+
*
79+
* @param array $instance The settings for the particular instance of the widget.
80+
*
81+
* @return void
82+
*/
4783
protected function content( $instance ) { }
4884

4985

5086
//_____HELPER METHODS_____
5187

5288

53-
// See scbForms::input()
54-
// Allows extra parameter $args['title']
89+
/**
90+
* Generates a input form field.
91+
*
92+
* @param array $args
93+
* @param array $formdata (optional)
94+
*
95+
* @return string
96+
*/
5597
protected function input( $args, $formdata = array() ) {
5698
$prefix = array( 'widget-' . $this->id_base, $this->number );
5799

0 commit comments

Comments
 (0)