summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhass2009-08-29 20:58:23 (GMT)
committer hass2009-08-29 20:58:23 (GMT)
commita4ee3630159cf281383b51c7b4f249b670bba30a (patch)
tree0ea56c61f5e47cce3ebf374335c7f2b23b75f8fc
parent5764a3d601bfa328fd2485d712202553e1a1f92c (diff)
Minor code style issue.
-rw-r--r--i18nsync/i18nsync.module45
1 files changed, 23 insertions, 22 deletions
diff --git a/i18nsync/i18nsync.module b/i18nsync/i18nsync.module
index 6b47067..5423e9a 100644
--- a/i18nsync/i18nsync.module
+++ b/i18nsync/i18nsync.module
@@ -91,7 +91,7 @@ function i18nsync_form_alter(&$form, $form_state, $form_id) {
case 'node_delete_confirm':
// Intercept form submission so we can handle uploads, replace callback
$form['#submit'] = array_merge(array('i18nsync_node_delete_submit'), $form['#submit']);
- break;
+ break;
case 'node_admin_content':
if (!empty($form['operation']) && $form['operation']['#value'] == 'delete') {
$form['#submit'] = array_merge(array('i18nsync_node_delete_submit'), $form['#submit']);
@@ -101,7 +101,7 @@ function i18nsync_form_alter(&$form, $form_state, $form_id) {
}
/**
- * Submit callback for
+ * Submit callback for
* - node delete confirm
* - node multiple delete confirm
*/
@@ -115,10 +115,10 @@ function i18nsync_node_delete_submit($form, $form_state) {
// Multiple nodes
foreach ($form_state['values']['nodes'] as $nid => $value) {
i18nsync_node_delete_prepare($nid);
- }
+ }
}
}
- // Then it will go through normal form submission
+ // Then it will go through normal form submission
}
/**
@@ -126,7 +126,7 @@ function i18nsync_node_delete_submit($form, $form_state) {
*/
function i18nsync_node_delete_prepare($nid) {
$node = node_load($nid);
- // Delete file associations when files are shared with existing translations
+ // Delete file associations when files are shared with existing translations
// so they are not removed by upload module
if (!empty($node->tnid) && module_exists('upload')) {
$result = db_query('SELECT u.* FROM {upload} u WHERE u.nid = %d AND u.fid IN (SELECT t.fid FROM {upload} t WHERE t.fid = u.fid AND t.nid <> u.nid)', $nid);
@@ -173,6 +173,7 @@ function i18nsync_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
}
}
break;
+
case 'prepare translation':
// We copy over all the fields to be synchronized.
if ($fields = i18nsync_node_fields($node->type)) {
@@ -263,7 +264,7 @@ function i18nsync_node_translation($node, $translation, $fields, $op) {
if (isset($content_fields[$field]) && isset($node->$field)) {
switch ($content_fields[$field]['type']) {
// TODO take type specific actions.
-
+
// Filefields and imagefields are syncronized equally.
case 'filefield':
case 'imagefield':
@@ -299,7 +300,7 @@ function i18nsync_node_translation($node, $translation, $fields, $op) {
// @todo Weird things may happen if 'images' and 'files' are both selected
case 'files':
// Sync existing attached files. This should work for images too
-
+
foreach ((array)$node->files as $fid => $file) {
if (isset($translation->files[$fid])) {
$translation->files[$fid]->list = is_array($file) ? $file['list'] : $file->list;
@@ -380,7 +381,7 @@ function i18nsync_node_translation_filefield_field(&$node, &$translation, $field
$translated_images = array();
foreach ($node->$field as $file) {
$found = false;
-
+
// Try to find existing translations of the filefield items and reference them.
foreach ($translation->$field as $translation_image) {
if ($file['fid'] == $translation_image['fid']) {
@@ -388,7 +389,7 @@ function i18nsync_node_translation_filefield_field(&$node, &$translation, $field
$found = true;
}
}
-
+
// If there was no translation found for the filefield item, just copy it.
if (!$found) {
$translated_images[] = $file;
@@ -434,14 +435,14 @@ function i18nsync_node_fields($type) {
/**
* Returns list of available fields for given content type.
- *
+ *
* There are two hidden variables (without UI) that can be used to add fields
* with the form array('field' => 'Field name')
* - i18nsync_fields_node
* - i18nsync_fields_node_$type;
- *
+ *
* Fields can also be changed using hook_i18nsync_fields_alter($fields, $type)
- *
+ *
* @param $type
* Node type.
*/
@@ -468,17 +469,17 @@ function i18nsync_node_available_fields($type) {
if (module_exists('upload')) {
$options['files'] = t('File attachments');
}
-
+
// If no type defined yet, that's it.
$fields['node']['#options'] = $options;
-
+
if (!$type) {
return $fields;
}
-
+
// Get variable for this node type.
$fields += variable_get("i18nsync_fields_node_$type", array());
-
+
// Image and image attach.
if (module_exists('image') && $type == 'image') {
$image['images'] = t('Image files');
@@ -488,7 +489,7 @@ function i18nsync_node_available_fields($type) {
}
if (!empty($image)) {
$fields['image']['#title'] = t('Image module');
- $fields['image']['#options'] = $image;
+ $fields['image']['#options'] = $image;
}
// Event fields.
if (variable_get('event_nodeapi_'. $type, 'never') != 'never') {
@@ -512,7 +513,7 @@ function i18nsync_node_available_fields($type) {
$fields['cck']['#options'][$data['field_name']] = $data['widget']['label'];
}
}
-
+
// Give a chance to modules to change/remove/add their own fields
drupal_alter('i18nsync_fields', $fields, $type);
@@ -526,13 +527,13 @@ function i18nsync_node_available_fields($type) {
*/
function _i18nsync_cck_fields($type) {
if (($content = module_invoke('content', 'types', $type)) && !empty($content['fields'])) {
- return $content['fields'];
+ return $content['fields'];
}
}
/**
* Get node translations if any, optionally excluding this node
- *
+ *
* Translations will be stored in the node itself so we have them cached
*/
function _i18nsync_node_translations($node, $exclude = FALSE) {
@@ -542,12 +543,12 @@ function _i18nsync_node_translations($node, $exclude = FALSE) {
unset($translations[$node->language]);
}
return $translations;
- }
+ }
}
/**
* Implementation of hook_file_references()
- *
+ *
* Inform CCK's filefield that we have other nodes using that file so it won't be deleted
*/
function i18nsync_file_references($file) {