/var/www/html_uk/wp-content/plugins/automatewoo/includes/Fields/Taxonomy_Term.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// phpcs:ignoreFile

namespace AutomateWoo\Fields;

if ( ! 
defined'ABSPATH' ) ) exit;

/**
 * @class Taxonomy_Term
 */
class Taxonomy_Term extends Field {

    protected 
$name 'term';

    protected 
$type 'term';


    function 
__construct() {
        
parent::__construct();
        
$this->classes[] = 'automatewoo-json-search';
        
$this->set_title__'Term''automatewoo' ) );
    }


    
/**
     * @param string $value
     */
    
function render$value ) {
        
$term  false;
        
$value = (string) $value;

        if ( 
strstr$value'|' ) ) {
            list( 
$term_id$taxonomy ) = explode'|'$value );
            
$term get_term_by'id'$term_id$taxonomy );
        }

        
?>

        <select type="hidden"
                class="<?php echo esc_attr$this->get_classes() ) ?>"
                name="<?php echo esc_attr$this->get_full_name() ); ?>"
                data-placeholder="<?php esc_attr_e'Search for a term&hellip;''automatewoo' ); ?>"
                data-action="aw_json_search_taxonomy_terms"
                data-pass-sibling="aw_workflow_data[trigger_options][taxonomy]"
                <?php echo ( $this->get_required() ? 'required' '' ?>
        >
            <?php
            
if ( is_object$term ) ) {
                echo 
'<option value="' esc_attr$term->term_id '|' $term->taxonomy ) . '"' selectedtruetruefalse ) . '>' wp_kses_post$term->name ) . '</option>';
            }
            
?>
         </select>

    <?php
    
}

}