|
139 | 139 | 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
|
140 | 140 | 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
|
141 | 141 | ),
|
| 142 | + array( |
| 143 | + 'id' => 'opt-select-terms', |
| 144 | + 'type' => 'select', |
| 145 | + 'data' => 'terms', |
| 146 | + 'title' => esc_html__( 'Terms Select Option', 'your-textdomain-here' ), |
| 147 | + 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), |
| 148 | + 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), |
| 149 | + ), |
| 150 | + array( |
| 151 | + 'id' => 'opt-multi-select-terms', |
| 152 | + 'type' => 'select', |
| 153 | + 'data' => 'terms', |
| 154 | + 'multi' => true, |
| 155 | + 'title' => esc_html__( 'Terms Multi Select Option', 'your-textdomain-here' ), |
| 156 | + 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), |
| 157 | + 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), |
| 158 | + ), |
142 | 159 | array(
|
143 | 160 | 'id' => 'opt-select-menus',
|
144 | 161 | 'type' => 'select',
|
|
237 | 254 | 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
|
238 | 255 | 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
|
239 | 256 | ),
|
| 257 | + array( |
| 258 | + 'id' => 'opt-select-callback', |
| 259 | + 'type' => 'select', |
| 260 | + 'data' => 'callback', |
| 261 | + 'args' => 'redux_select_callback', |
| 262 | + 'title' => esc_html__( 'Select Option using a Callback', 'your-textdomain-here' ), |
| 263 | + 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), |
| 264 | + 'desc' => esc_html__( 'The items in this selcect were added via a callback function.', 'your-textdomain-here' ), |
| 265 | + ), |
240 | 266 | ),
|
241 | 267 | )
|
242 | 268 | );
|
| 269 | + |
| 270 | +/** |
| 271 | + * Select callback function. |
| 272 | + * |
| 273 | + * @return array |
| 274 | + */ |
| 275 | +function redux_select_callback(): array { |
| 276 | + $options = array(); |
| 277 | + |
| 278 | + $options[0] = esc_html__( 'Zero', 'your-textdomain-here' ); |
| 279 | + $options[1] = esc_html__( 'One', 'your-textdomain-here' ); |
| 280 | + $options[2] = esc_html__( 'Two', 'your-textdomain-here' ); |
| 281 | + $options[3] = esc_html__( 'Three', 'your-textdomain-here' ); |
| 282 | + |
| 283 | + return $options; |
| 284 | +} |
0 commit comments