1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Internationalization (i18n) hooks
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* Implements hook_i18n_object_info().
|
9 |
|
|
*/
|
10 |
|
|
function i18n_block_i18n_object_info() {
|
11 |
|
|
$info['block'] = array(
|
12 |
|
|
'title' => t('Block'),
|
13 |
|
|
'class' => 'i18n_block_object',
|
14 |
|
|
'load callback' => 'block_load',
|
15 |
|
|
'key' => array('module', 'delta'),
|
16 |
|
|
'placeholders' => array(
|
17 |
|
|
'%module' => 'module',
|
18 |
|
|
'%delta' => 'delta',
|
19 |
|
|
),
|
20 |
|
|
'edit path' => 'admin/structure/block/manage/%module/%delta/configure',
|
21 |
|
|
'string translation' => array(
|
22 |
|
|
'textgroup' => 'blocks',
|
23 |
|
|
'properties' => array(
|
24 |
|
|
'title' => array(
|
25 |
|
|
'title' => t('Title'),
|
26 |
|
|
'empty' => '<none>',
|
27 |
|
|
),
|
28 |
|
|
'body' => array(
|
29 |
|
|
'title' => t('Body'),
|
30 |
|
|
'format' => 'format',
|
31 |
|
|
),
|
32 |
|
|
),
|
33 |
|
|
'translate path' => 'admin/structure/block/manage/%module/%delta/translate/%i18n_language',
|
34 |
|
|
)
|
35 |
|
|
);
|
36 |
|
|
return $info;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
/**
|
40 |
|
|
* Implements hook_i18n_string_info().
|
41 |
|
|
*/
|
42 |
|
|
function i18n_block_i18n_string_info() {
|
43 |
|
|
$groups['blocks'] = array(
|
44 |
|
|
'title' => t('Blocks'),
|
45 |
|
|
'description' => t('Configurable blocks titles and content.'),
|
46 |
|
|
'format' => TRUE, // This group has strings with format (block body)
|
47 |
|
|
'list' => TRUE, // This group can list all strings
|
48 |
|
|
);
|
49 |
|
|
return $groups;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
* Implements hook_i18n_string_objects().
|
54 |
|
|
*/
|
55 |
|
|
function i18n_block_i18n_string_objects($type) {
|
56 |
|
|
if ($type == 'block') {
|
57 |
|
|
$query = db_select('block', 'b')
|
58 |
|
|
->distinct()
|
59 |
|
|
->fields('b', array('module', 'delta', 'title', 'i18n_mode'))
|
60 |
|
|
->fields('bc', array('body', 'format'))
|
61 |
|
|
->condition('i18n_mode', I18N_MODE_LOCALIZE);
|
62 |
|
|
$query->leftJoin('block_custom', 'bc', 'b.bid = bc.bid');
|
63 |
|
|
return $query->execute()->fetchAll(PDO::FETCH_OBJ);
|
64 |
|
|
}
|
65 |
|
|
} |