From 0fc931c92d5ab05cb6e346c10bfc497b3306bc8c Mon Sep 17 00:00:00 2001 From: Earl Miles <merlin@logrus.com> Date: Wed, 6 May 2009 01:10:05 +0000 Subject: [PATCH] #416298: Provide a mechanism so modules such as Hierarchical Select can cooperate with delegator form overriding. --- plugins/contexts/node_add_form.inc | 8 +++++++- plugins/contexts/node_edit_form.inc | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/contexts/node_add_form.inc b/plugins/contexts/node_add_form.inc index 529096e6..63286d4b 100644 --- a/plugins/contexts/node_add_form.inc +++ b/plugins/contexts/node_add_form.inc @@ -56,10 +56,16 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); ctools_include('form'); - module_load_include('inc', 'node', 'node.pages'); $form_id = $node['type'] . '_node_form'; $form_state = array('want form' => TRUE, 'args' => array($node)); + + $file = drupal_get_path('module', 'node') . '/node.pages.inc'; + include_once './' . $file; + // This piece of information can let other modules know that more files + // need to be included if this form is loaded from cache: + $form_state['form_load_files'] = array($file); + $form = ctools_build_form($form_id, $form_state); // In a form, $data is the object being edited. $context->data = $type; diff --git a/plugins/contexts/node_edit_form.inc b/plugins/contexts/node_edit_form.inc index 91fbb3e6..df0e6339 100644 --- a/plugins/contexts/node_edit_form.inc +++ b/plugins/contexts/node_edit_form.inc @@ -45,11 +45,17 @@ function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALS } if (!empty($node)) { - module_load_include('inc', 'node', 'node.pages'); ctools_include('form'); $form_id = $node->type . '_node_form'; $form_state = array('want form' => TRUE, 'args' => array($node)); + + $file = drupal_get_path('module', 'node') . '/node.pages.inc'; + include_once './' . $file; + // This piece of information can let other modules know that more files + // need to be included if this form is loaded from cache: + $form_state['form_load_files'] = array($file); + $form = ctools_build_form($form_id, $form_state); // Fill in the 'node' portion of the context -- GitLab