/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }
/** * Implements hook_views_bulk_operations_form_alter(). */ function vbo_redirect_option_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) { $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; if( isset($vbo_redirect_url) && strlen($vbo_redirect_url) >0 ){ // check if vbo operation skip confirmation $skip_confirmation = false ; foreach( $vbo->options['vbo_operations'] as $key => $operation ){ if( $operation['selected'] && $operation['skip_confirmation'] ){ if( isset($form['select'][$key]) ) { $form['select'][$key]['#submit'][] = 'vbo_redirect_after_operation'; $skip_confirmation = true ; } } } // set redirect method when vbo has confirmation step if( !$skip_confirmation ){ $form['actions']['submit']['#submit'][] = 'vbo_redirect_after_operation' ; } } } // callback function to set redirect url function vbo_redirect_after_operation($form, &$form_state){ $vbo_redirect_url = trim( variable_get('vbo_redirect_url') ) ; $form_state['redirect'] = $vbo_redirect_url; }
添付 | サイズ |
---|---|
vbo_redirect_option.zip (1.19 KB) | 1.19 KB |
// \sites\all\modules\views_bulk_operations\plugins\operation_types\action.class.php // 147~167行のあたりに、以下のオプション追加関数があります public function adminOptionsForm($dom_id, $field_handler) { $form = parent::adminOptionsForm($dom_id, $field_handler); // 拡張オプション定義関数名を以下のように作成 $settings_form_callback = $this->operationInfo['callback'] . '_views_bulk_operations_form'; if (function_exists($settings_form_callback)) { $settings = $this->getAdminOption('settings', array()); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Operation settings'), '#collapsible' => TRUE, '#dependency' => array( $dom_id . '-selected' => array(1), ), ); $settings_dom_id = $dom_id . '-settings'; $form['settings'] += $settings_form_callback($settings, $this->entityType, $settings_dom_id); } return $form; }
/** * Implements hook_form_alter(). */ function vbo_redirect_option_form_alter(&$form, &$form_state, $form_id) { // VBOの処理かのチェック if( isset($form_state['id']) && $form_state['id'] === "views_bulk_operations"){ // ここで、画面遷移先の保存処理は少し反則 // vbo_settingsに画面遷移先の追加は難しい(クラス構造体内にあるため) // 環境変数に画面遷移先(uri)を保存 if( isset($form_state['input']['options']['vbo_settings'][vbo_redirect_url]) ){ variable_set( 'vbo_redirect_url', $form_state['input']['options']['vbo_settings'][vbo_redirect_url] ) ; } // 画面遷移先のテキストフィールドを追加 $form['options']['vbo_settings']['vbo_redirect_url'] = array( '#type' => 'textfield', '#title' => t('Page to direct to after completion of batch'), '#description' => t('Redirects to the view when finished the operation'), '#default_value' => variable_get('vbo_redirect_url'), ); } }