- * Get the drupal destination string. When this is passed in the
- * URL the user will be directed to it after filling in the drupal form
- *
- * @param CRM_Core_Form $form
- * Form object representing the 'current' form - to which the user will be returned.
- * @return null|string
- * destination value for URL
- */
- public function getLoginDestination(&$form) {
- $args = NULL;
-
- $id = $form->get('id');
- if ($id) {
- $args .= "&id=$id";
- }
- else {
- $gid = $form->get('gid');
- if ($gid) {
- $args .= "&gid=$gid";
- }
- else {
- // Setup Personal Campaign Page link uses pageId
- $pageId = $form->get('pageId');
- if ($pageId) {
- $component = $form->get('component');
- $args .= "&pageId=$pageId&component=$component&action=add";
- }
- }
- }
-
- $destination = NULL;
- if ($args) {
- // append destination so user is returned to form they came from after login
- $destination = CRM_Utils_System::currentPath() . '?reset=1' . $args;
- }
- return $destination;
- }
-
- /**
- * Get user login URL for hosting CMS (method declared in each CMS system class)
- *
- * @param string $destination
- * If present, add destination to querystring (works for Drupal only).
- *
- * @return string
- * loginURL for the current CMS