function social_post_preprocess_field in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.2 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.3 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.4 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.5 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.6 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.7 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 8.8 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 10.3.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 10.0.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 10.1.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
- 10.2.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
Prepares variables for comment field templates.
Default template: field--comment.html.twig.
@todo Rename to template_preprocess_field__comment() once https://www.drupal.org/node/939462 is resolved.
Parameters
array $variables: An associative array containing:
- element: An associative array containing render arrays for the list of comments, and the comment form. Array keys: comments, comment_form.
File
- modules/
social_features/ social_post/ social_post.module, line 192 - The Social post module.
Code
function social_post_preprocess_field(array &$variables) {
$element = $variables['element'];
if ($element['#formatter'] == 'comment_post') {
// Create separate variables for the more_link.
$variables['more_link'] = $element[0]['more_link'];
}
}