2

On the event form, there is a checkbox called Public Event. I would like to change to something else. But it seems there is no hook to do this:

$this->addElement('checkbox', 'is_public', ts('Public Event')); 

Could anyone confirm if it's possible without use JavaScript?

2 Answers 2

3

You could use the Word Replacement feature with no code to change the string 'Public Event' to something else.

Here's a link to the documentation: https://docs.civicrm.org/user/en/latest/initial-set-up/customizing-the-user-interface/#using-word-replacement-to-change-terminology

3
1

Yes possible to do it using build form hook, but you will still need to play around with the label of the field because its a checkbox and is written differently. So using JS you will need to replace the section with correct format.

/**
 * Implements hook_civicrm_buildForm().
 *
 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm
 */
function cisitepasswords_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Event_Form_ManageEvent_EventInfo') {
    if ($form->elementExists('is_public')) {
      $form->removeElement('is_public');
      $form->addYesNo('is_public', ts('Public Event')); 
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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