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