1

I want to add a new template part to the activity edit & view page, I have been trying number of hooks to do it but could not figure out which one best to use.

enter image description here

I am trying to do something similar to what is explained here https://youtu.be/lrk8X_jt0wU?list=PLjSU7YfE0E00Xv9b_VqwjDjAcFUVtR8k5&t=837 but for activity edit & view pages.

function _myactivity_civix_civicrm_summary($contactID, $content){
CRM_Core_Region::instance('page-body')->add([
    'template' => 'templates/myactivity.tpl'
]);
}

Any suggestion or better approach would be great help.

Thanks in advance :)

  • so do you want to update the activity with specific word in the description once it is completed - Right? – Ramesh - ARTECH Consultancy Jul 10 '18 at 6:44
  • @ramesh - No, I am looking for correct hook or method to embed additional template files and display my extra stuff on the activity page. – Arun Singh Jul 10 '18 at 11:13
3

I am assuming you want to add some stuff at the bottom of the activity page, correct?

First of all, you need to establish if you are adding to a civicrm page or form. You can do a little test with the hook buildForm (see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/) and check the formName or with the hook pageRun (see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_pageRun/) and check the name of the page.

Once you have established which hook you need to use you can add the template with the CRM_Core_Region.

  • Thank you @erikh-civicoop, I think hook_civicrm_buildForm is the right hook for me, I am testing with it. You are correct that I want to add some extra stuff at the bottom of the activity page. – Arun Singh Jul 10 '18 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.