From 4b7c50ebb33470633d3253b423bf70d5946e6d26 Mon Sep 17 00:00:00 2001
From: Rick Jones <rick@activeservice.co.uk>
Date: Tue, 14 Nov 2017 15:09:51 +0000
Subject: [PATCH] Issue #2923404 by Rick J: VBO: allow selection of default
 template when configuring view

---
 node_convert.module | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
 mode change 100755 => 100644 node_convert.module

diff --git a/node_convert.module b/node_convert.module
old mode 100755
new mode 100644
index 2a03549..4fa8390
--- a/node_convert.module
+++ b/node_convert.module
@@ -271,6 +271,26 @@ function node_convert_convert_action(&$node, &$context = array()) {
 }
 
 /**
+ * Node convert VBO edit action settings form.
+ */
+function node_convert_convert_action_views_bulk_operations_form($options) {
+  $result = db_query("SELECT * FROM {node_convert_templates}");
+  $templates = array(0 => 'none');
+  foreach ($result as $row) {
+    $templates[$row->nctid] = $row->name;
+  }
+  $form['template'] = array(
+    '#type' => 'select',
+    '#title' => t("Template"),
+    '#description' => t("Conversion template to use when the action is fired."),
+    '#options' => $templates,
+    '#default_value' => isset($options['template']) ? $options['template'] : '',
+  );
+
+  return $form;
+}
+
+/**
  * Node convert action form.
  */
 function node_convert_convert_action_form($context) {
@@ -282,15 +302,13 @@ function node_convert_convert_action_form($context) {
       $templates[$row->nctid] = $row->name;
     }
   }
-  if (isset($context['template'])) {
-    $default_template = $context['template'];
-  }
+  $settings = $context['settings'];
   $form['template'] = array(
     '#type' => 'select',
     '#title' => t("Template"),
     '#description' => t("Convesion template to use when the action is fired."),
     '#options' => $templates,
-    '#default_value' => isset($default_template) ? $default_template : '',
+    '#default_value' => isset($settings['template']) ? $settings['template'] : '',
   );
 
   return $form;
-- 
2.11.0

