Skip to content
Snippets Groups Projects
Commit 63ed7110 authored by Earl Miles's avatar Earl Miles
Browse files

#367213: Do not throw away an already built form when falling back. Just render what we have.

parent f427f87f
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ html.js div.ctools-dropdown div.ctools-dropdown-container ul li { ...@@ -28,7 +28,7 @@ html.js div.ctools-dropdown div.ctools-dropdown-container ul li {
/* Everything from here down is purely visual style and can be overridden. */ /* Everything from here down is purely visual style and can be overridden. */
html.js div.ctools-dropdown a.ctools-dropdown-link { html.js div.ctools-dropdown a.ctools-dropdown-text-link {
background: url(../images/collapsible-expanded.png) 3px 5px no-repeat; background: url(../images/collapsible-expanded.png) 3px 5px no-repeat;
padding-left: 12px; padding-left: 12px;
} }
......
...@@ -76,8 +76,10 @@ function delegator_node_edit($node) { ...@@ -76,8 +76,10 @@ function delegator_node_edit($node) {
$output = ctools_context_handler_render($task, '', $contexts); $output = ctools_context_handler_render($task, '', $contexts);
if ($output === FALSE) { if ($output === FALSE) {
// Fall back! // Fall back!
module_load_include('inc', 'node', 'node.pages'); // We've already built the form with the context, so we can't build it again, or
$output = drupal_get_form($node->type . '_node_form', $node); // form_clean_id will mess up our ids. But we don't really need to, either:
$context = current($contexts);
$output = drupal_render_form($context->form_id, $context->form);
} }
return $output; return $output;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
function ctools_dropdown_theme(&$items) { function ctools_dropdown_theme(&$items) {
$items['ctools_dropdown'] = array( $items['ctools_dropdown'] = array(
'arguments' => array('title' => NULL, 'links' => NULL), 'arguments' => array('title' => NULL, 'links' => NULL, 'image' => FALSE, 'class' => ''),
'file' => 'includes/dropdown.theme.inc', 'file' => 'includes/dropdown.theme.inc',
); );
} }
...@@ -47,12 +47,15 @@ function ctools_dropdown_theme(&$items) { ...@@ -47,12 +47,15 @@ function ctools_dropdown_theme(&$items) {
* @param $links * @param $links
* A list of links to provide within the dropdown, suitable for use * A list of links to provide within the dropdown, suitable for use
* in via Drupal's theme('links'). * in via Drupal's theme('links').
* @param $image
* If true, the dropdown link is an image and will not get extra decorations
* that a text dropdown link will.
* @param $class * @param $class
* An optional class to add to the dropdown's container div to allow you * An optional class to add to the dropdown's container div to allow you
* to style a single dropdown however you like without interfering with * to style a single dropdown however you like without interfering with
* other dropdowns. * other dropdowns.
*/ */
function theme_ctools_dropdown($title, $links, $class = '') { function theme_ctools_dropdown($title, $links, $image = FALSE, $class = '') {
// Provide a unique identifier for every dropdown on the page. // Provide a unique identifier for every dropdown on the page.
static $id = 0; static $id = 0;
$id++; $id++;
...@@ -65,12 +68,20 @@ function theme_ctools_dropdown($title, $links, $class = '') { ...@@ -65,12 +68,20 @@ function theme_ctools_dropdown($title, $links, $class = '') {
$output = ''; $output = '';
$output .= '<div class="' . $class . '" id="ctools-dropdown-' . $id . '">'; $output .= '<div class="' . $class . '" id="ctools-dropdown-' . $id . '">';
$output .= '<div class="ctools-dropdown-link-wrapper">'; // Test fix for IE $output .= '<div class="ctools-dropdown-link-wrapper">';
$output .= '<a href="#" class="ctools-dropdown-link">' . check_plain($title) . '</a>'; if ($image) {
$output .= '<a href="#" class="ctools-dropdown-link ctools-dropdown-image-link">' . $title . '</a>';
}
else {
$output .= '<a href="#" class="ctools-dropdown-link ctools-dropdown-text-link">' . check_plain($title) . '</a>';
}
$output .= '</div>'; // wrapper $output .= '</div>'; // wrapper
$output .= '<div class="ctools-dropdown-container-wrapper">';
$output .= '<div class="ctools-dropdown-container">'; $output .= '<div class="ctools-dropdown-container">';
$output .= theme('links', $links); $output .= theme('links', $links);
$output .= '</div>'; // container $output .= '</div>'; // container
$output .= '</div>'; // container wrapper
$output .= '</div>'; // dropdown $output .= '</div>'; // dropdown
return $output; return $output;
} }
......
...@@ -48,8 +48,11 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE ...@@ -48,8 +48,11 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE
global $user; global $user;
$node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);
$form = drupal_retrieve_form($type . '_node_form', $node); ctools_include('form');
drupal_process_form($type . '_node_form', $form); $form_id = $node->type . '_node_form';
$form_state = array('want form' => TRUE, 'args' => array($node));
$form = ctools_build_form($form_id, $form_state);
// In a form, $data is the object being edited. // In a form, $data is the object being edited.
$context->data = $type; $context->data = $type;
$context->title = $types[$type]->name; $context->title = $types[$type]->name;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment