Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function formModifications_form_alter(&$form,&$form_state,$form_id){
- if ($form_id == 'node_admin_content') {
- $form['admin']['options']['operation']['#options']['send_for_translation'] = t('Send For Translation');
- $form['admin']['options']['submit']['#submit'][] = 'custom_send_for_translation_submit_admin';
- }
- }
- function custom_send_for_translation_submit_admin($form, &$form_state) {
- foreach ($form_state['values']['nodes'] as $key => $value) {
- if ($value != 0) {
- $selected[] = node_load($key);
- }
- }
- foreach ($selected as $key => $value ){
- $structure = './sites/all/tempfolder/';
- if(!is_dir($structure))
- {
- mkdir($structure, 0, true);
- }
- $fileName = $value->title;
- $sPattern = '/\s*/m';
- $sReplace = '';
- $refinedFileName = preg_replace( $sPattern, $sReplace, $fileName ).".xml";
- $finalRefinedFileName = $structure.$refinedFileName;
- $ourFileHandle = fopen($finalRefinedFileName, 'w') or die("can't open file");
- $xml = array(
- 'title' => $value->title,
- 'body' => $value->body,
- );
- }
- fclose($ourFileHandle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement