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