Guest User

Untitled

a guest
Oct 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.07 KB | None | 0 0
  1. <?php
  2.  
  3. function nppa_profile_form_alter(&$form, &$form_state, $form_id){
  4.     global $user;
  5.  
  6.     switch($form_id){
  7.         case "user_profile_form":
  8.             drupal_add_library('system','ui.datepicker');
  9.             drupal_add_css((drupal_get_path('module', 'nppa_profile') . '/css/edit-profile.css'),array("type"=>"file","weight"=>"1000", "preprocess"=>FALSE, "group"=> CSS_THEME));
  10.            
  11.             $nid=73; // grab this from preferences in the future...
  12.             $node = node_load($nid);
  13.             webform_node_view($node,"full");
  14.            
  15.            
  16.             //jtools_out($node->content['webform']["#form"]);
  17.             // lets remove some unnecessary items:
  18.             $form['account']['mail']['#description'] = "Your email address";
  19.             $form['account']['pass']['#description'] = "";
  20.             unset($form['field_skill_set']);
  21.            
  22.             $form['#attached'] = $node->content['webform']["#form"]['#attached'];
  23.             $form["#node"] = $node;
  24.            
  25.             $append = $node->content['webform']["#form"]['submitted'];
  26.             nppa_profile_add_validation($append);
  27.             $form['submitted'] = $append;
  28.            
  29.             // Finally add our event handlers and send this off!
  30.             $form['#submit'][] = "nppa_profile_user_profile_form_submit";
  31.             $form['#validate'][] = "nppa_profile_user_profile_form_validate";
  32.            
  33.            
  34.             $form["#suffix"] = "<style>
  35.                                     #webform-component-civicrm-1-contact-1-fieldset-fieldset--civicrm-2-contact-1-fieldset-fieldset--civicrm-2-contact-1-contact-existing,
  36.                                     #webform-component-civicrm-1-contact-1-fieldset-fieldset--civicrm-2-contact-1-fieldset-fieldset--civicrm-2-contact-1-contact-organization-name{display:none;}
  37.                                 </style>
  38.                                 <script>
  39.                                     jQuery('#webform-component-civicrm-1-contact-1-fieldset-fieldset--civicrm-2-contact-1-fieldset-fieldset--civicrm-2-contact-1-contact-existing').css('display','block');
  40.                                     jQuery('#user-profile-form').addClass('webform-client-form');
  41.                                     jQuery('#user-profile-form').attr('id','webform-client-form-" . $nid . "');
  42.                                     jQuery('#edit-submitted-civicrm-1-contact-1-fieldset-fieldset-civicrm-1-contact-1-contact-birth-date').datepicker();
  43.                                 </script>";
  44.             fl($form);
  45.             break;
  46.     }
  47. }
Add Comment
Please, Sign In to add comment