View source
<?php
define('I18N_BOXES_LOCALIZE', '__LOCALIZE__');
function i18n_boxes_ctools_plugin_api($module, $api) {
if ($module == 'boxes' && $api == 'plugins') {
return array(
'version' => 1,
);
}
}
function i18n_boxes_boxes_plugins() {
$info = array();
$path = drupal_get_path('module', 'i18n_boxes') . '/plugins/boxes';
$info['i18n'] = array(
'title' => 'Box (translatable)',
'handler' => array(
'parent' => 'simple',
'class' => 'boxes_i18n',
'file' => 'boxes_i18n.inc',
'path' => $path,
),
);
return $info;
}
function i18n_boxes_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'block_admin_configure' || $form_id == 'block_box_form' || $form_id == 'block_add_block_form') {
if (module_exists('i18nblocks')) {
$form['i18n']['#access'] = FALSE;
}
}
}
function i18n_boxes_locale($op = 'groups', $group = NULL) {
switch ($op) {
case 'groups':
return array(
'boxes' => t('Boxes'),
);
case 'info':
$info['boxes']['refresh callback'] = 'i18n_boxes_locale_refresh';
$info['boxes']['format'] = TRUE;
return $info;
}
}
function i18n_boxes_locale_refresh() {
$boxes = boxes_load();
if (!empty($boxes)) {
foreach ($boxes as $delta => $box) {
if ($box->plugin_key == 'i18n') {
$box
->locale_refresh();
}
}
}
return TRUE;
}