Elasticsearch.php 718 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace ColdTrick\Questions;
  3. class Elasticsearch {
  4. /**
  5. * Add answers to the exported types for Elasticsearch
  6. *
  7. * @param string $hook the name of the hook
  8. * @param string $type the type of the hook
  9. * @param array $return_value current return value
  10. * @param array $params supplied params
  11. *
  12. * @return void|array
  13. */
  14. public static function indexTypes($hook, $type, $return_value, $params) {
  15. $objects = elgg_extract('object', $return_value);
  16. if (empty($objects)) {
  17. return;
  18. }
  19. if (!in_array(\ElggQuestion::SUBTYPE, $objects)) {
  20. return;
  21. }
  22. $objects[] = \ElggAnswer::SUBTYPE;
  23. $return_value['object'] = $objects;
  24. return $return_value;
  25. }
  26. }