original_string: public function doAddPackage($data, Form $form) {
          $record=new SnippetPackage();
          if($record->canEdit()) {
              $form->saveInto($record);
              $record->write();
              
              
              Requirements::customScript("window.parent.jQuery('#".$this->getName()."').entwine('ss').handleSuccessResult(".$record->ID.");");
              return $this->renderWith('CMSDialog', array('Form'=>''));
          }
          
          return Controller::curr()->redirectBack();
      }
code: public function doAddPackage($data, Form $form) {
          $record=new SnippetPackage();
          if($record->canEdit()) {
              $form->saveInto($record);
              $record->write();
              
              
              Requirements::customScript("window.parent.jQuery('#".$this->getName()."').entwine('ss').handleSuccessResult(".$record->ID.");");
              return $this->renderWith('CMSDialog', array('Form'=>''));
          }
          
          return Controller::curr()->redirectBack();
      }
code_tokens: public function doAddPackage ( $ data , Form $ form ) { $ record = new SnippetPackage ( ) ; if ( $ record -> canEdit ( ) ) { $ form -> saveInto ( $ record ) ; $ record -> write ( ) ; Requirements :: customScript ( "window.parent.jQuery('#" . $ this -> getName ( ) . "').entwine('ss').handleSuccessResult(" . $ record -> ID . ");" ) ; return $ this -> renderWith ( 'CMSDialog' , array ( 'Form' => '' ) ) ; } return Controller :: curr ( ) -> redirectBack ( ) ; }
docstring: Handles adding of the package
  @param {array} $data Submitted data
  @param {Form} $form Submitting form
  @return {mixed}
docstring_tokens: Handles adding of the package