Country.php
1.25 KB
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
<?php
namespace ACA\WC\Column\User;
use ACA\WC\Search;
use ACA\WC\Settings;
use ACP;
class Country extends ACP\Column\Meta
implements ACP\Export\Exportable, ACP\Search\Searchable, ACP\ConditionalFormat\Formattable
{
use ACP\ConditionalFormat\ConditionalFormatTrait;
public function __construct()
{
$this->set_type('column-wc-user-country')
->set_label(__('Country', 'woocommerce'))
->set_group('woocommerce');
}
public function get_meta_key()
{
return $this->get_address_type() . '_country';
}
public function export()
{
return new ACP\Export\Model\Value($this);
}
private function get_address_type()
{
return $this->get_setting('address_type')->get_value();
}
public function register_settings()
{
$this->add_setting(new Settings\User\Country($this));
}
public function search()
{
return new Search\User\Country($this->get_meta_key(), WC()->countries->get_countries());
}
public function editing()
{
return new ACP\Editing\Service\Basic(
new ACP\Editing\View\Select(WC()->countries->get_countries()),
new ACP\Editing\Storage\User\Meta($this->get_meta_key())
);
}
}