|
@@ 38-46 (lines=9) @@
|
| 35 |
|
* @param array|callable $options |
| 36 |
|
* @return self $this |
| 37 |
|
*/ |
| 38 |
|
public function set_options( $options ) { |
| 39 |
|
if ( ! is_callable( $options ) && ! is_array( $options ) ) { |
| 40 |
|
Incorrect_Syntax_Exception::raise( 'Only arrays and callbacks are allowed in the <code>set_options()</code> method.' ); |
| 41 |
|
return $this; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
$this->option_collections = array(); |
| 45 |
|
return $this->add_options( $options ); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
/** |
| 49 |
|
* Add new options to this field. |
|
@@ 55-63 (lines=9) @@
|
| 52 |
|
* @param array|callable $options |
| 53 |
|
* @return self $this |
| 54 |
|
*/ |
| 55 |
|
public function add_options( $options ) { |
| 56 |
|
if ( ! is_callable( $options ) && ! is_array( $options ) ) { |
| 57 |
|
Incorrect_Syntax_Exception::raise( 'Only arrays and callbacks are allowed in the <code>add_options()</code> method.' ); |
| 58 |
|
return $this; |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
$this->option_collections[] = $options; |
| 62 |
|
return $this; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
/** |
| 66 |
|
* Get a populated array of options executing any callbacks in the process |