You are here

function social_post_preprocess_field in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  2. 8.2 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  3. 8.3 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  4. 8.4 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  5. 8.5 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  6. 8.6 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  7. 8.7 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  8. 8.8 modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  9. 10.3.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  10. 10.0.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  11. 10.1.x modules/social_features/social_post/social_post.module \social_post_preprocess_field()
  12. 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'];
  }
}