diff --git a/fb_stream.module b/fb_stream.module index e6557ee..6b593d7 100644 --- a/fb_stream.module +++ b/fb_stream.module @@ -75,11 +75,15 @@ function fb_stream_node_insert($node) { ); if ($node->fb_stream_image !== '_none') { - // The $node does not contain data about the picture, so the load data node separately + // The $node does not contain data about the picture, + // so the load data node separately. $node_origin = node_load($node->nid); - // The field can be empty - if (isset($node_origin->{$node->fb_stream_image}['und'][0]['uri'])) { - $params['picture'] = image_style_url('thumbnail', $node_origin->{$node->fb_stream_image}['und'][0]['uri']); + + $langcode = !isset($node_origin->{$node->fb_stream_image}[$node->language]) ? LANGUAGE_NONE : $node->language; + + // The field can be empty. + if (isset($node_origin->{$node->fb_stream_image}[$langcode][0]['uri'])) { + $params['picture'] = image_style_url('thumbnail', $node_origin->{$node->fb_stream_image}[$langcode][0]['uri']); } } @@ -96,7 +100,7 @@ function fb_stream_node_insert($node) { if ($result['id']) { // TODO: link to proper wall. drupal_set_message(t('Content posted to Facebook.')); - // Remember the field selection for the type of material + // Remember the field selection for the type of material. variable_set('fb_stream_image__' . $node->type, $node->fb_stream_image); } } @@ -242,7 +246,10 @@ function fb_stream_form_alter(&$form, &$form_state, $form_id) { } /** - * Output all fields - picture + * Output all fields - picture. + * + * @param $content_type + * Name content type. */ function _fb_stream_only_image_fields($content_type = 'article') { $fields = field_info_instances("node", $content_type); @@ -252,7 +259,7 @@ function _fb_stream_only_image_fields($content_type = 'article') { if (!empty($fields)) { foreach ($fields as $name => $field) { if (isset($field['widget']['type']) && $field['widget']['type'] == 'image_image') { - $result[$name] = $field['label'] . ('(' . $name . ')'); + $result[$name] = $field['label'] . (' (' . $name . ')'); } } }