create.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Post comment river view
  4. */
  5. $item = $vars['item'];
  6. /* @var ElggRiverItem $item */
  7. $comment = $item->getObjectEntity();
  8. $subject = $item->getSubjectEntity();
  9. $target = $item->getTargetEntity();
  10. $subject_link = elgg_view('output/url', array(
  11. 'href' => $subject->getURL(),
  12. 'text' => $subject->name,
  13. 'class' => 'elgg-river-subject',
  14. 'is_trusted' => true,
  15. ));
  16. $target_link = elgg_view('output/url', array(
  17. 'href' => $comment->getURL(),
  18. 'text' => $target->getDisplayName(),
  19. 'class' => 'elgg-river-target',
  20. 'is_trusted' => true,
  21. ));
  22. $type = $target->getType();
  23. $subtype = $target->getSubtype() ? $target->getSubtype() : 'default';
  24. $key = "river:comment:$type:$subtype";
  25. $summary = elgg_echo($key, array($subject_link, $target_link));
  26. if ($summary == $key) {
  27. $key = "river:comment:$type:default";
  28. $summary = elgg_echo($key, array($subject_link, $target_link));
  29. }
  30. echo elgg_view('river/elements/layout', array(
  31. 'item' => $vars['item'],
  32. 'message' => elgg_get_excerpt($comment->description),
  33. 'summary' => $summary,
  34. // truthy value to bypass responses rendering
  35. 'responses' => ' ',
  36. ));