1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Extend XenForo_Search_SourceHandler_Abstract

Discussion in 'XenForo Development Discussions' started by r1pe, May 18, 2013.

  1. r1pe

    r1pe Member


    I have a question regarding the XenForo_Search_SourceHandler_Abstract class. I want to extend the method "processConstraints". Controllers and Models can be easily extended by creating an event listener like "load_class_controller" or "load_class_model". How I can do this in abstract classes? I found the "search_source_create" event listener but I don't know how to use it and if this the right one for extending the abstract class.

    Can someone give me a short example how I can extend the XenForo_Search_SourceHandler_Abstract class?

    Thanks in advanced.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can't extend abstract classes directly, only normal classes that are instantiated.

    The search_source_create event can be used to replace the default source handler. You could duplicate XenForo_Search_SourceHandler_MySqlFt, extend processConstraints in your new source handler, then specify that source handler using the search_source_create event.

Share This Page