create.php 829 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * River entry for new answers
  4. */
  5. $item = elgg_extract('item', $vars);
  6. $answer = $item->getObjectEntity();
  7. if (!($answer instanceof ElggAnswer)) {
  8. return;
  9. }
  10. $subject = $item->getSubjectEntity();
  11. $question = $answer->getContainerEntity();
  12. $subject_link = elgg_view('output/url', [
  13. 'href' => $subject->getURL(),
  14. 'text' => $subject->name,
  15. 'class' => 'elgg-river-subject',
  16. 'is_trusted' => true,
  17. ]);
  18. $object_link = elgg_view('output/url', [
  19. 'href' => $question->getURL(),
  20. 'text' => elgg_get_excerpt($question->title, 100),
  21. 'class' => 'elgg-river-object',
  22. 'is_trusted' => true,
  23. ]);
  24. $message = elgg_get_excerpt($answer->description);
  25. echo elgg_view('river/elements/layout', [
  26. 'item' => $item,
  27. 'message' => $message,
  28. 'summary' => elgg_echo('river:create:object:answer', [$subject_link, $object_link]),
  29. ]);