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