_contributionIds = []; $values = $form->getSearchFormValues(); $form->_task = $values['task'] ?? NULL; $ids = $form->getIDs(); $form->_componentClause = $form->getComponentClause(); $form->assign('totalSelectedContributions', count($ids)); $form->_contributionIds = $form->_componentIds = $ids; $form->set('contributionIds', $form->_contributionIds); $form->setNextUrl('contribute'); } /** * Sets contribution Ids for unit test. * * @param array $contributionIds */ public function setContributionIds(array $contributionIds): void { $this->ids = $contributionIds; } /** * Given the contribution id, compute the contact id * since its used for things like send email */ public function setContactIDs(): void { if (!$this->isQueryIncludesSoftCredits()) { $this->_contactIds = CRM_Core_DAO::getContactIDsFromComponent( $this->_contributionIds, 'civicrm_contribution' ); } } /** * Simple shell that derived classes can call to add buttons to * the form with a customized title for the main Submit * * @param string $title * Title of the main button. * @param string $nextType * Button type for the form after processing. * @param string $backType * @param bool $submitOnce */ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) { $this->addButtons([ [ 'type' => $nextType, 'name' => $title, 'isDefault' => TRUE, ], [ 'type' => $backType, 'name' => ts('Cancel'), ], ]); } /** * Get the token processor schema required to list any tokens for this task. * * @return array */ public function getTokenSchema(): array { return ['contributionId', 'contactId']; } }