|
@@ 44-51 (lines=8) @@
|
| 41 |
|
* |
| 42 |
|
* @param array|callable $options |
| 43 |
|
*/ |
| 44 |
|
public function add_options( $options ) { |
| 45 |
|
if ( ! is_callable( $options ) && ! is_array( $options ) ) { |
| 46 |
|
Incorrect_Syntax_Exception::raise( 'Only arrays and callbacks are allowed in the <code>add_options()</code> method.' ); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
$this->option_collections[] = $options; |
| 50 |
|
return $this; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
/** |
| 54 |
|
* Check if there are callbacks and populate the options |
|
@@ 29-36 (lines=8) @@
|
| 26 |
|
* |
| 27 |
|
* @param array|callable $options |
| 28 |
|
*/ |
| 29 |
|
public function set_options( $options ) { |
| 30 |
|
if ( ! is_callable( $options ) && ! is_array( $options ) ) { |
| 31 |
|
Incorrect_Syntax_Exception::raise( 'Only arrays and callbacks are allowed in the <code>set_options()</code> method.' ); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
$this->option_collections = array(); |
| 35 |
|
return $this->add_options( $options ); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
/** |
| 39 |
|
* Add new options to this field. |