Skip to content

Commit d53bc68

Browse files
authored
Merge pull request #869 from alleyinteractive/docs/issue-867/update-constructor-docblocks-for-label-parameter
Issue-867: Update class constructor docblocks to support specifying an `array` or a `string` for `$label`
2 parents a63b186 + 1beab31 commit d53bc68

15 files changed

+32
-32
lines changed

php/class-fieldmanager-autocomplete.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class Fieldmanager_Autocomplete extends Fieldmanager_Field {
6565
*
6666
* @throws FM_Developer_Exception Must use a datasource.
6767
*
68-
* @param string $label The label.
69-
* @param array $options The options for the field.
68+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
69+
* @param array $options The field options.
7070
*/
7171
public function __construct( $label = '', $options = array() ) {
7272
$this->attributes = array(

php/class-fieldmanager-colorpicker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class Fieldmanager_Colorpicker extends Fieldmanager_Field {
3232
/**
3333
* Build the colorpicker object and enqueue assets.
3434
*
35-
* @param string $label The label to use.
36-
* @param array $options The options.
35+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
36+
* @param array $options The field options.
3737
*/
3838
public function __construct( $label = '', $options = array() ) {
3939
fm_add_script( 'fm_colorpicker', 'js/fieldmanager-colorpicker.js', array( 'fm_loader', 'jquery', 'wp-color-picker' ), FM_VERSION, true );

php/class-fieldmanager-datepicker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class Fieldmanager_Datepicker extends Fieldmanager_Field {
6565
/**
6666
* Construct default attributes and enqueue JavaScript.
6767
*
68-
* @param string $label Field label.
69-
* @param array $options Associative array of class property values. @see Fieldmanager_Field::__construct().
68+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
69+
* @param array $options The field options.
7070
*/
7171
public function __construct( $label = '', $options = array() ) {
7272
fm_add_style( 'fm-jquery-ui', 'css/jquery-ui/jquery-ui-1.10.2.custom.min.css' );

php/class-fieldmanager-draggablepost.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class Fieldmanager_DraggablePost extends Fieldmanager_Field {
4747
/**
4848
* Add scripts and styles and other setup tasks.
4949
*
50-
* @param string $label The label.
51-
* @param array $options The field options.
50+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
51+
* @param array $options The field options.
5252
*/
5353
public function __construct( $label = '', $options = array() ) {
5454
_deprecated_function( __METHOD__, '1.2.0' );

php/class-fieldmanager-field.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ public function form_element( $value ) {
401401
* Superclass constructor, just populates options and sanity-checks common elements.
402402
* It might also die, but only helpfully, to catch errors in development.
403403
*
404-
* @param string $label Title of form field.
405-
* @param array $options With keys matching vars of the field in use.
404+
* @param string|array $label The field label.
405+
* @param array $options The field options.
406406
*/
407407
public function __construct( $label = '', $options = array() ) {
408408
$this->set_options( $label, $options );
@@ -429,8 +429,8 @@ public function __construct( $label = '', $options = array() ) {
429429
* @throws FM_Developer_Exception If an option is set but not defined in this class or the child class.
430430
* @throws FM_Developer_Exception If an option is set but not public.
431431
*
432-
* @param string $label Title of form field.
433-
* @param array $options With keys matching vars of the field in use.
432+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
433+
* @param array $options The field options.
434434
*/
435435
public function set_options( $label, $options ) {
436436
if ( is_array( $label ) ) {

php/class-fieldmanager-grid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class Fieldmanager_Grid extends Fieldmanager_Field {
3939
/**
4040
* Constructor which adds several scrips and CSS.
4141
*
42-
* @param string $label The form label.
43-
* @param array $options The form options.
42+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
43+
* @param array $options The field options.
4444
*/
4545
public function __construct( $label = '', $options = array() ) {
4646
_deprecated_function( __METHOD__, '1.4.0' );

php/class-fieldmanager-group.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ class Fieldmanager_Group extends Fieldmanager_Field {
139139
*
140140
* @throws FM_Developer_Exception Not serializing data with repeatable groups.
141141
*
142-
* @param string $label The form label.
143-
* @param array $options The form options.
142+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
143+
* @param array $options The field options.
144144
*/
145145
public function __construct( $label = '', $options = array() ) {
146146

php/class-fieldmanager-link.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Fieldmanager_Link extends Fieldmanager_Textfield {
1313
/**
1414
* Construct default attributes, set link sanitizer.
1515
*
16-
* @param string $label The form label.
17-
* @param array $options The form options.
16+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
17+
* @param array $options The field options.
1818
*/
1919
public function __construct( $label = '', $options = array() ) {
2020
$this->sanitize = 'esc_url_raw';

php/class-fieldmanager-media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class Fieldmanager_Media extends Fieldmanager_Field {
9595
/**
9696
* Construct default attributes.
9797
*
98-
* @param string $label The form label.
99-
* @param array $options The form options.
98+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
99+
* @param array $options The field options.
100100
*/
101101
public function __construct( $label = '', $options = array() ) {
102102
$this->button_label = __( 'Attach a File', 'fieldmanager' );

php/class-fieldmanager-options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ abstract class Fieldmanager_Options extends Fieldmanager_Field {
6464
/**
6565
* Add CSS, construct parent.
6666
*
67-
* @param string $label The form label.
68-
* @param mixed $options The form options.
67+
* @param string|array $label The field label. A provided string sets $options['label'], while an array sets $options, overriding any existing data in $options.
68+
* @param array $options The field options.
6969
*/
7070
public function __construct( $label = '', $options = array() ) {
7171
$this->sanitize = array( $this, 'sanitize' );

0 commit comments

Comments
 (0)