-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguageListTable.php
More file actions
59 lines (58 loc) · 1.68 KB
/
LanguageListTable.php
File metadata and controls
59 lines (58 loc) · 1.68 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
56
57
58
59
<?php
if(!class_exists('WP_List_Table')){
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class LanguageListTable extends WP_List_Table
{
private $urlSettingsPage;
private $languageList;
public function __construct($languageList, $urlSettingPage)
{
parent::__construct(['screen' => 'language']);
$this->languageList = $languageList;
$this->urlSettingsPage = $urlSettingPage;
}
public function prepare_items()
{
$data = [];
$textEnable = __('Enable');
$textDisable = __('Disable');
$textDefault = __('Default');
/**
* @var $language Language
*/
foreach ($this->languageList as $code => $language) {
$languageAction = '';
$data[] = [
'name' => "{$language->getFlagHtml()} {$language->name}",
'code' => "[:{$language->code}]",
'locale' => "{$language->locale}",
'facebook' => "{$language->facebook}",
'action' => $languageAction
];
}
$this->items = $data;
}
public function get_columns()
{
return [
'name' => __('Name'),
'code' => __('Code'),
'locale' => __('Wordpress'),
'facebook' => __('Facebook'),
'action' => __('Action')
];
}
protected function column_default($item, $column_name)
{
return $item[$column_name];
}
protected function get_default_primary_column_name()
{
return 'name';
}
protected function display_tablenav($which)
{
}
}