Search.php 728 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace ColdTrick\Questions;
  3. class Search {
  4. /**
  5. * Handle search hook, to include answers in the same set as questions
  6. *
  7. * @param string $hook the name of the hook
  8. * @param string $type the type of the hook
  9. * @param mixed $return_value current return value
  10. * @param array $params supplied params
  11. *
  12. * @return void|mixed
  13. */
  14. public static function handleQuestionsSearch($hook, $type, $return_value, $params) {
  15. if (empty($params) || !is_array($params)) {
  16. return;
  17. }
  18. unset($params['subtype']);
  19. $params['subtypes'] = [
  20. \ElggAnswer::SUBTYPE,
  21. \ElggQuestion::SUBTYPE,
  22. ];
  23. return elgg_trigger_plugin_hook('search', 'object', $params, $return_value);
  24. }
  25. }