Definition in file node_add_form.inc.
Go to the source code of this file.
Functions | |
| panels_context_create_node_add_form ($empty, $data=NULL, $conf=FALSE) | |
| panels_context_node_add_form_settings_form ($conf, $external=FALSE) | |
| panels_node_add_form_panels_contexts () | |
| panels_context_create_node_add_form | ( | $ | empty, | |
| $ | data = NULL, |
|||
| $ | conf = FALSE | |||
| ) |
It's important to remember that $conf is optional here, because contexts are not always created from the UI.
Definition at line 27 of file node_add_form.inc.
00027 { 00028 $context = new panels_context(array('form', 'node_add', 'node_form')); 00029 $context->plugin = 'node_add_form'; 00030 00031 if ($empty) { 00032 return $context; 00033 } 00034 00035 if ($conf) { 00036 $data = $data['type']; 00037 } 00038 00039 if (!empty($data)) { 00040 $types = node_get_types(); 00041 $type = str_replace('-', '_', $data); 00042 00043 // Validate the node type exists. 00044 if (isset($types[$type]) && node_access('create', $type)) { 00045 // Initialize settings: 00046 global $user; 00047 $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); 00048 00049 $form = drupal_retrieve_form($type . '_node_form', $node); 00050 drupal_process_form($type . '_node_form', $form); 00051 // In a form, $data is the object being edited. 00052 $context->data = $type; 00053 $context->title = $types[$type]->name; 00054 $context->argument = $type; 00055 00056 // These are specific pieces of data to this form. 00057 // All forms should place the form here. 00058 $context->form = $form; 00059 $context->form_id = $type . '_node_form'; 00060 $context->form_title = t('Submit @name', array('@name' => $types[$type]->name)); 00061 $context->node_type = $type; 00062 return $context; 00063 } 00064 } 00065 }
| panels_context_node_add_form_settings_form | ( | $ | conf, | |
| $ | external = FALSE | |||
| ) |
Definition at line 67 of file node_add_form.inc.
00067 { 00068 if ($external) { 00069 $options[0] = t('External source'); 00070 } 00071 00072 foreach (node_get_types() as $type => $info) { 00073 $options[$type] = $info->name; 00074 } 00075 00076 $form['type'] = array( 00077 '#title' => t('Node type'), 00078 '#type' => 'select', 00079 '#options' => $options, 00080 '#default_value' => $conf['type'], 00081 '#description' => t('Select the node type for this form.'), 00082 ); 00083 00084 if ($external) { 00085 $form['type']['#description'] .= ' ' . t('Select external to require this from an external source (such as a containing panel page).'); 00086 } 00087 00088 return $form; 00089 }
| panels_node_add_form_panels_contexts | ( | ) |
Definition at line 11 of file node_add_form.inc.
00011 { 00012 $args['node_add_form'] = array( 00013 'title' => t("Node add form"), 00014 'description' => t('A node add form.'), 00015 'context' => 'panels_context_create_node_add_form', 00016 'settings form' => 'panels_context_node_add_form_settings_form', 00017 'keyword' => 'node_add', 00018 'context name' => 'node_add_form', 00019 ); 00020 return $args; 00021 }
1.5.6