You are here

function social_post_preprocess_activity in Open Social 8.5

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.6 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  4. 8.7 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  5. 8.8 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  6. 10.3.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  7. 10.0.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  8. 10.1.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
  9. 10.2.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 214
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'];
    $variables['visibility_icon'] = social_post_get_visibility_details($post
      ->get('field_visibility')->value, 'icon');
    $variables['visibility_label'] = social_post_get_visibility_details($post
      ->get('field_visibility')->value, 'label');
  }
}