Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-15965

Custom searches cannot specify custom task menu

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.5, 4.6
    • Fix Version/s: 4.5.8, 4.6
    • Component/s: CiviCRM Search
    • Labels:
      None
    • Documentation Required?:
      Developer Doc

      Description

      Custom searches should be able to define a custom task menu (i.e., a list of actions the searcher can perform on the result set). Hook_civicrm_searchTasks allows a module developer to modify the task list based on the object type (Contact, Activity, etc.), but it does not allow for specifying the list with form-by-form granularity.

      It seems that a developer should be able to modify the task list in the custom search class's buildForm method by calling $form->addTaskMenu($tasklist), because $form is a CRM_Core_Form_Search. However, custom searches are a sort of plugin to CRM_Contact_Form_Search_Custom (custom searches are instantiated as a property _customClass), and in CRM_Contact_Form_Search_Custom->buildQuickForm, parent::buildQuickForm is called AFTER the custom form's buildForm method, clobbering any attempt to modify the task menu.

      I think the solution is to rewrite parent::buildQuickForm (aka CRM_Contact_Form_Search->buildQuickForm) in such a way that the building of the task list can be delegated to another function.

      There was some conversation about this on IRC: http://irc.civicrm.org/logs/%23civicrm.log.2015-02-09.txt.

        Attachments

          Activity

            People

            • Assignee:
              pittstains Frank J. Gómez
              Reporter:
              pittstains Frank J. Gómez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: