1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Internationalization (i18n) module - Translation set
|
5 |
|
|
*/
|
6 |
|
|
/**
|
7 |
|
|
* @file
|
8 |
|
|
* Internationalization (i18n) module - Translation set
|
9 |
|
|
*/
|
10 |
|
|
class i18n_taxonomy_translation_set extends i18n_translation_set {
|
11 |
|
|
/**
|
12 |
|
|
* Load all term translations
|
13 |
|
|
*/
|
14 |
|
|
public function load_translations() {
|
15 |
|
|
return i18n_translation_set_index(taxonomy_term_load_multiple(array(), array('i18n_tsid' => $this->tsid)));
|
16 |
|
|
}
|
17 |
|
|
|
18 |
|
|
/**
|
19 |
|
|
* Get placeholder values for path replacement
|
20 |
|
|
*/
|
21 |
|
|
function get_path_placeholders($op = 'list') {
|
22 |
|
|
$values = parent::get_path_placeholders($op);
|
23 |
|
|
if (!empty($this->bundle)) {
|
24 |
|
|
$values['%taxonomy_vocabulary_machine_name'] = $this->bundle;
|
25 |
|
|
}
|
26 |
|
|
return $values;
|
27 |
|
|
}
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
/**
|
31 |
|
|
* Taxonomy textgroup handler
|
32 |
|
|
*/
|
33 |
|
|
class i18n_taxonomy_term extends i18n_string_object_wrapper {
|
34 |
|
|
/**
|
35 |
|
|
* Translation mode for object
|
36 |
|
|
*/
|
37 |
|
|
public function get_translate_mode() {
|
38 |
|
|
$mode = i18n_taxonomy_vocabulary_mode($this->object->vid);
|
39 |
|
|
if ($this->get_langcode()) {
|
40 |
|
|
return $mode & I18N_MODE_TRANSLATE;
|
41 |
|
|
}
|
42 |
|
|
else {
|
43 |
|
|
return $mode & I18N_MODE_LOCALIZE;
|
44 |
|
|
}
|
45 |
|
|
}
|
46 |
|
|
/**
|
47 |
|
|
* Access to object translation. This should check object properties and permissions
|
48 |
|
|
*/
|
49 |
|
|
protected function translate_access() {
|
50 |
|
|
return taxonomy_term_edit_access($this->object) && $this->get_langcode() && user_access('translate interface');
|
51 |
|
|
}
|
52 |
|
|
} |