Only in node_pane/js: node-pane.entity-bundle.js
diff -ur node_pane/node_pane.info node_pane-7.x-1.x-dev/node_pane.info
--- node_pane/node_pane.info	2015-09-18 12:55:09.000000000 +0200
+++ node_pane-7.x-1.x-dev/node_pane.info	2013-10-01 04:25:01.000000000 +0200
@@ -10,16 +10,3 @@
 project = "node_pane"
 datestamp = "1380594301"
 
-; Patches
-; https://www.drupal.org/node/2065005
-; https://www.drupal.org/node/1859374
-
-; Changes
-; - Added a admin UI section on each content type to define how it content can be administered:
-;     [ ] Use in 'Panels'
-;         [ ] Select existing content in panels
-;             [ Select the selection view ] => defaults to node_pane_selection
-;         [ ] Create new content in panels
-;
-; - Added check if user is allowed to create content, if not the "Create new <content-type>" is removed.
-; - Added direct node editing from within IPE though the "edit" button in the pane buttonbar
\ No newline at end of file
diff -ur node_pane/node_pane.module node_pane-7.x-1.x-dev/node_pane.module
--- node_pane/node_pane.module	2015-09-18 12:45:58.000000000 +0200
+++ node_pane-7.x-1.x-dev/node_pane.module	2012-03-14 16:56:31.000000000 +0100
@@ -23,54 +23,36 @@
   $ctools_content_types = array();
 
   foreach(node_type_get_types() as $name => $node_type) {
-    if (node_pane_access('use_in_panels', $node_type->type)) {
-
-      if (node_pane_access('select_in_panels', $node_type->type)) {
-        $ctools_content_types['existing_node_' . $name] = array(
-          'title' => t('Choose an existing @type', array('@type' => $node_type->name)),
-          'description' => t('Add a @type from your site as content.', array('@type' => $node_type->name)),
-          'add form' => array(
-            'ctools_node_content_type_selection_form' => t('Choose an existing @type', array('@type' => $node_type->name)),
-            'ctools_node_content_type_edit_form' => array(
-              'default' => TRUE, // put wrapper here, not on the previous form.
-              'title' => t('Configure display'),
-            ),
-          ),
-          'edit form' => array(
-            'ctools_node_content_type_edit_node_form' => t('Edit @type', array('@type' => $node_type->name)),
-            'ctools_node_content_type_edit_form' => array(
-              'default' => TRUE, // put wrapper here, not on the previous form.
-              'title' => t('Configure display'),
-            ),
-          ),
-          'category' => t('Content'),
-        );
-      }
-
-      if (node_access('create', $node_type->type) && node_pane_access('create_in_panels', $node_type->type)) {
-        $ctools_content_types[$name] = array(
-          'title' => t('New @type', array('@type' => $node_type->name)),
-          'description' => $node_type->description,
-          'category' => t('Content'),
-          'add form' => array(
-            'ctools_node_content_type_add_form' => t('Add new @type', array('@type' => $node_type->name)),
-            'ctools_node_content_type_edit_form' => array(
-              'default' => TRUE, // put wrapper here, not on the previous form.
-              'title' => t('Configure display'),
-            ),
-          ),
-          'edit form' => array(
-            'ctools_node_content_type_edit_node_form' => t('Edit @type', array('@type' => $node_type->name)),
-            'ctools_node_content_type_edit_form' => array(
-              'default' => TRUE, // put wrapper here, not on the previous form.
-              'title' => t('Configure display'),
-            ),
-          ),
-        );
-      }
-    }
+    $ctools_content_types[$name] = array(
+      'title' => t('New @type', array('@type' => $node_type->name)),
+      'description' => $node_type->description,
+      'category' => array(t('Content')),
+      'add form' => array(
+        'ctools_node_content_type_add_form' => t('Add new @type', array('@type' => $node_type->name)),
+        'ctools_node_content_type_edit_form' => array(
+          'default' => TRUE, // put wrapper here, not on the previous form.
+          'title' => t('Configure display'),
+        ),
+      ),
+      'edit form' => 'ctools_node_content_type_edit_form',
+    );
   }
 
+  // Add an existing node.
+  $ctools_content_types['existing_node'] = array(
+    'title' => t('Choose an existing content'),
+    'description' => t('Add a node from your site as content.'),
+    'add form' => array(
+      'ctools_node_content_type_selection_form' => t('Choose an existing content'),
+      'ctools_node_content_type_edit_form' => array(
+        'default' => TRUE, // put wrapper here, not on the previous form.
+        'title' => t('Configure display'),
+      ),
+    ),
+    'edit form' => 'ctools_node_content_type_edit_form',
+    'category' => array(t('Content')),
+  );
+
   return $ctools_content_types;
 }
 
@@ -88,12 +70,10 @@
  */
 function ctools_node_content_type_selection_form($form, &$form_state) {
   // add a default view as form prefix for selecting the content
-  // the view is set through the content type admin ui.
-
-  $view_name = variable_get('node_pane-select_in_panels_view', 'node_pane_selection:default');
-  list($view, $display) = explode(':', $view_name);
-
-  $form['#prefix'] = views_embed_view($view, $display);
+  // get the view name from a variable, to make it possible to provide a
+  // different view
+  $view_name = variable_get('node_pane_selection_view', 'node_pane_selection');
+  $form['#prefix'] = views_embed_view($view_name, 'default');
   if(!empty($form['#prefix'])) {
     // switch from text input element to hidden
     $form['selected_nid'] = array(
@@ -124,36 +104,15 @@
 }
 
 /**
- * The form to add or edit a node as content.
- */
-function ctools_node_content_type_edit_node_form($form, &$form_state) {
-  $conf = $form_state['conf'];
-
-  module_load_include('inc', 'node', 'node.pages');
-
-  $node = node_load($conf['nid']);
-
-  $form += node_form($form, $form_state, $node);
-
-  // Remove the submit and preview buttons.
-  $form['actions']['#access'] = FALSE;
-
-  $form['buttons']['next']['#submit'][] = 'node_pane_content_type_add_form_return_submit';
-
-  return $form;
-}
-
-/**
  * Add form for node panes.
  */
 function ctools_node_content_type_add_form($form, &$form_state) {
   global $user;
-  global $language;
 
   module_load_include('inc', 'node', 'node.pages');
 
   $type = $form_state['subtype_name'];
-  $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => $language);
+  $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => LANGUAGE_NONE);
 
   $form += node_form($form, $form_state, $node);
 
@@ -175,116 +134,3 @@
   $form_state['conf']['nid'] = $form_state['values']['nid'];
 }
 
-/**
- * Function to determine if a node type can be used for node pane selection.
- *
- * @param $access
- * @param $type
- *
- * @return boolean
- */
-function node_pane_access($access, $type) {
-  $permission = variable_get('node_pane-' . $type . '-' . $access, FALSE);
-  return $permission;
-}
-
-/**
- * Implements a delegated hook_form_alter.
- *
- * We want to add Panelizer settings for the bundle to the node type form.
- */
-function node_pane_form_alter(&$form, &$form_state, $form_id) {
-  if ($form_id == 'node_type_form') {
-    if (isset($form['#node_type'])) {
-      $bundle = $form['#node_type']->type;
-
-      $settings = array(
-        'use_in_panels' => variable_get('node_pane-' . $bundle . '-use_in_panels', TRUE),
-        'select_in_panels' => variable_get('node_pane-' . $bundle . '-select_in_panels', TRUE),
-        'select_in_panels_view' => variable_get('node_pane-' . $bundle . '-select_in_panels_view', 'node_pane_selection:default'),
-        'create_in_panels' => variable_get('node_pane-' . $bundle . '-create_in_panels', TRUE),
-      );
-
-      $form['node_pane'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Node pane'),
-        '#collapsible' => TRUE,
-        '#collapsed' => FALSE,
-        '#group' => 'additional_settings',
-        '#attributes' => array(
-          'class' => array('node-pane-entity-bundle'),
-        ),
-        '#bundle' => $bundle,
-        '#tree' => TRUE,
-        '#attached' => array(
-          'js' => array(ctools_attach_js('node-pane.entity-bundle', 'node_pane')),
-        ),
-      );
-
-      $form['node_pane']['use_in_panels'] = array(
-        '#title' => t('Use content type in panels'),
-        '#type' => 'checkbox',
-        '#id' => 'node_pane-use_in_panels',
-        '#default_value' => !empty($settings['use_in_panels']),
-        '#description' => t('Enables this content type inside the "Content" category of the pane selection dialog box.'),
-      );
-      $form['node_pane']['select_in_panels'] = array(
-        '#title' => t('Select existing content in panels'),
-        '#type' => 'checkbox',
-        '#id' => 'node_pane-select_in_panels',
-        '#default_value' => !empty($settings['select_in_panels']),
-        '#description' => t('If this content type is enabled, this setting allows to select existing content inside the "Content" category of the pane selection dialog box using the view defined below.'),
-        '#states' => array(
-          'visible' => array(
-            '#node_pane-use_in_panels' => array('checked' => TRUE),
-          ),
-        ),
-      );
-
-      $form['node_pane']['select_in_panels_view'] = array(
-        '#title' => t('Select existing content in panels using this view'),
-        '#type' => 'select',
-        '#id' => 'node_pane-select_in_panels_view',
-        '#default_value' => $settings['select_in_panels'],
-        '#options' => views_get_views_as_options(),
-        '#description' => t('Select existing content in panels using this view.'),
-        '#states' => array(
-          'visible' => array(
-            '#node_pane-use_in_panels' => array('checked' => TRUE),
-            '#node_pane-select_in_panels' => array('checked' => TRUE),
-          ),
-        ),
-      );
-      $form['node_pane']['create_in_panels'] = array(
-        '#title' => t('Create new content in panels'),
-        '#type' => 'checkbox',
-        '#id' => 'node_pane-create_in_panels',
-        '#default_value' => !empty($settings['create_in_panels']),
-        '#description' => t('If this content type is enabled, this setting allows to create new content directly from inside the "Content" category of the pane selection dialog box.'),
-        '#states' => array(
-          'visible' => array(
-            '#node_pane-use_in_panels' => array('checked' => TRUE),
-          ),
-        ),
-      );
-
-      array_unshift($form['#submit'], 'node_pane_entity_default_bundle_form_submit');
-    }
-  }
-}
-
-/**
- * Submit handler for our settings on the content type form.
- * @param $form
- * @param $form_state
- */
-function node_pane_entity_default_bundle_form_submit($form, &$form_state) {
-  $values = $form_state['values']['node_pane'];
-  $bundle = $form['node_pane']['#bundle'];
-
-  variable_set('node_pane-' . $bundle . '-use_in_panels', $values['use_in_panels']===0);
-  variable_set('node_pane-' . $bundle . '-select_in_panels', $values['select_in_panels']===0);
-  variable_set('node_pane-' . $bundle . '-select_in_panels_view', $values['select_in_panels_view']);
-  variable_set('node_pane-' . $bundle . '-create_in_panels', $values['create_in_panels']===0);
-
-}
