Uncanny_Codes_Helpers::get_all_code_batch( null $label = null, string $option_code = 'UCBATCH', bool $is_any = false )
Contents
Parameters Parameters
- $label
-
(Optional)
Default value: null
- $option_code
-
(Optional)
Default value: 'UCBATCH'
- $is_any
-
(Optional)
Default value: false
Return Return
(array|mixed|void)
Source Source
File: src/integrations/uncanny-codes/helpers/uncanny-codes-helpers.php
public function get_all_code_batch( $label = null, $option_code = 'UCBATCH' ) { if ( ! $this->load_options ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } if ( ! $label ) { $label = esc_attr__( 'Prefix', 'uncanny-automator' ); } global $wpdb; $options = array(); $all_batches = $wpdb->get_results( 'SELECT DISTINCT id, name FROM ' . $wpdb->prefix . 'uncanny_codes_groups', ARRAY_A ); if ( ! $all_batches ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } foreach ( $all_batches as $batch ) { if ( ! empty( $batch['name'] ) ) { $options[ $batch['id'] ] = $batch['name']; } } natcasesort( $options ); $option = array( 'option_code' => $option_code, 'label' => $label, 'input_type' => 'select', 'required' => true, 'options' => $options, 'relevant_tokens' => array( $option_code => esc_attr__( 'Batch', 'uncanny-automator' ), 'UNCANNYCODESBATCHEXPIRY' => esc_attr__( 'Batch Expiry date', 'uncanny-automator' ), ), ); return apply_filters( 'uap_option_get_all_code_batch', $option ); }
Expand full source code Collapse full source code View on Github