You are here

function social_post_preprocess_activity in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  2. 8.4 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  3. 8.5 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  4. 8.6 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  5. 8.7 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  6. 8.8 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  7. 10.3.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  8. 10.0.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  9. 10.1.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()

Implements hook_preprocess_activity().

File

modules/social_features/social_post/social_post.module, line 213
The Social post module.

Code

function social_post_preprocess_activity(&$variables) {

  // Add visibility icon and label to activity posts.
  if (!empty($variables['elements']['field_activity_entity'][0]['#post'])) {
    $post = $variables['elements']['field_activity_entity'][0]['#post'];
    $visibility = $post->field_visibility->value;
    $variables['visibility_icon'] = social_post_get_visibility_details($visibility);
    $variables['visibility_label'] = social_post_get_visibility_details($visibility, 'label');
  }
  $activity = $variables['elements']['#activity'];
  $post = $activity
    ->getRelatedEntity();
  if (!empty($post) && $post
    ->getEntityTypeId() === 'post') {
    $variables['post'] = TRUE;
    $variables['published'] = $post
      ->isPublished();
  }
}