function social_post_preprocess_activity in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 8.4 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 8.5 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 8.6 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 8.7 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 8.8 modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 10.3.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 10.0.x modules/social_features/social_post/social_post.module \social_post_preprocess_activity()
- 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();
}
}