Uncanny_Codes_Helpers::get_all_code_suffix( $label = null, $option_code = 'UCSUFFIX' )
Source Source
File: src/integrations/uncanny-codes/helpers/uncanny-codes-helpers.php
public function get_all_code_suffix( $label = null, $option_code = 'UCSUFFIX' ) { if ( ! $this->load_options ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } if ( ! $label ) { $label = esc_attr__( 'Suffix', 'uncanny-automator' ); } global $wpdb; $options = array(); $all_codes = $wpdb->get_results( 'SELECT DISTINCT suffix FROM ' . $wpdb->prefix . 'uncanny_codes_groups', ARRAY_A ); if ( ! $all_codes ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } foreach ( $all_codes as $code ) { if ( ! empty( $code['suffix'] ) ) { $suffix = Automator()->utilities->automator_sanitize( $code['suffix'] ); $options[ $suffix ] = $code['suffix']; } } $option = array( 'option_code' => $option_code, 'label' => $label, 'input_type' => 'select', 'required' => true, 'options' => $options, 'relevant_tokens' => array( $option_code => esc_attr__( 'Suffix', 'uncanny-automator' ), ), ); return apply_filters( 'uap_option_get_all_code_suffix', $option ); }
Expand full source code Collapse full source code View on Github