Exemplo n.º 1
0
    /**
     * Insert hidden Other fields
     *
     * @since 2.0.8
     * @param array $field
     * @param string|int|boolean $opt_key
     * @param string $html_id
     */
    private static function insert_hidden_other_fields($field, $opt_key)
    {
        $other_id = FrmFieldsHelper::get_other_field_html_id($field['original_type'], $field['html_id'], $opt_key);
        // Checkbox and multi-select dropdown fields
        if ($opt_key && !is_numeric($opt_key) && isset($_POST['item_meta']['other'][$field['id']][$opt_key]) && $_POST['item_meta']['other'][$field['id']][$opt_key]) {
            $posted_val = stripslashes_deep($_POST['item_meta']['other'][$field['id']][$opt_key]);
            ?>
			<input type="hidden" name="item_meta[other][<?php 
            echo esc_attr($field['id']);
            ?>
][<?php 
            echo esc_attr($opt_key);
            ?>
]" id="<?php 
            echo esc_attr($other_id);
            ?>
" value="<?php 
            echo esc_attr($posted_val);
            ?>
" />
		    <?php 
            // Radio fields and regular dropdowns
        } else {
            if (!is_array($field['value']) && !is_array($_POST['item_meta']['other'][$field['id']])) {
                $posted_val = stripslashes_deep($_POST['item_meta']['other'][$field['id']]);
                ?>
			<input type="hidden" name="item_meta[other][<?php 
                echo esc_attr($field['id']);
                ?>
]" id="<?php 
                echo esc_attr($other_id);
                ?>
" value="<?php 
                echo esc_attr($posted_val);
                ?>
" />
		    <?php 
            }
        }
    }