00001 <?php
00002
00003
00004
00005
00006
00007
00008 function panels_node_form_panels_content_types() {
00009 $items['node_form'] = array(
00010 'title' => t('Node form'),
00011 'content_types' => 'panels_admin_content_types_node_form',
00012 'render callback' => 'panels_content_node_form',
00013 'add callback' => 'panels_admin_edit_node_form',
00014 'edit callback' => 'panels_admin_edit_node_form',
00015 'title callback' => 'panels_admin_title_node_form',
00016 );
00017 return $items;
00018 }
00019
00020
00021
00022
00023 function panels_admin_content_types_node_form() {
00024 $content = array(
00025 'publishing' => array(
00026 'title' => t('Node form publishing options'),
00027 'icon' => 'icon_node.png',
00028 'path' => panels_get_path('content_types/node'),
00029 'description' => t('Publishing options on the Node form.'),
00030 'required context' => new panels_required_context(t('Form'), 'node_form'),
00031 'category' => array(t('Form'), -9),
00032 ),
00033 'author' => array(
00034 'title' => t('Node form author information'),
00035 'icon' => 'icon_node.png',
00036 'path' => panels_get_path('content_types/node'),
00037 'description' => t('Author information on the Node form.'),
00038 'required context' => new panels_required_context(t('Form'), 'node_form'),
00039 'category' => array(t('Form'), -9),
00040 ),
00041 'input_format' => array(
00042 'title' => t('Node form input format'),
00043 'icon' => 'icon_node.png',
00044 'path' => panels_get_path('content_types/node'),
00045 'description' => t('Input format for the body field on a node.'),
00046 'required context' => new panels_required_context(t('Form'), 'node_form'),
00047 'category' => array(t('Form'), -9),
00048 ),
00049 'log' => array(
00050 'title' => t('Node form log message'),
00051 'icon' => 'icon_node.png',
00052 'path' => panels_get_path('content_types/node'),
00053 'description' => t('Log message for the node.'),
00054 'required context' => new panels_required_context(t('Form'), 'node_form'),
00055 'category' => array(t('Form'), -9),
00056 ),
00057 );
00058 if (module_exists('comment')) {
00059 $content['comment'] = array(
00060 'title' => t('Node form comment settings'),
00061 'icon' => 'icon_node.png',
00062 'path' => panels_get_path('content_types/node'),
00063 'description' => t('Comment settings on the Node form.'),
00064 'required context' => new panels_required_context(t('Form'), 'node_form'),
00065 'category' => array(t('Form'), -9),
00066 );
00067 }
00068 if (module_exists('menu')) {
00069 $content['menu'] = array(
00070 'title' => t('Node form menu settings'),
00071 'icon' => 'icon_node.png',
00072 'path' => panels_get_path('content_types/node'),
00073 'description' => t('menu settings on the Node form.'),
00074 'required context' => new panels_required_context(t('Form'), 'node_form'),
00075 'category' => array(t('Form'), -9),
00076 );
00077 }
00078 if (module_exists('path')) {
00079 $content['url_path'] = array(
00080 'title' => t('URL Path settings'),
00081 'icon' => 'icon_node.png',
00082 'path' => panels_get_path('content_types/node'),
00083 'description' => t('Publishing options on the Node form.'),
00084 'required context' => new panels_required_context(t('Form'), 'node_form'),
00085 'category' => array(t('Form'), -9),
00086 );
00087 }
00088 if (module_exists('upload')) {
00089 $content['attachments'] = array(
00090 'title' => t('Node form file attachments'),
00091 'icon' => 'icon_node.png',
00092 'path' => panels_get_path('content_types/node'),
00093 'description' => t('File attachments on the Node form.'),
00094 'required context' => new panels_required_context(t('Form'), 'node_form'),
00095 'category' => array(t('Form'), -9),
00096 );
00097 }
00098 if (module_exists('taxonomy')) {
00099 $content['taxonomy'] = array(
00100 'title' => t('Node form categories'),
00101 'icon' => 'icon_node.png',
00102 'path' => panels_get_path('content_types/node'),
00103 'description' => t('Taxonomy categories for the node.'),
00104 'required context' => new panels_required_context(t('Form'), 'node_form'),
00105 'category' => array(t('Form'), -9),
00106 );
00107 }
00108 if (module_exists('book')) {
00109 $content['book'] = array(
00110 'title' => t('Node form book options'),
00111 'icon' => 'icon_node.png',
00112 'path' => panels_get_path('content_types/node'),
00113 'description' => t('Book options for the node.'),
00114 'required context' => new panels_required_context(t('Form'), 'node_form'),
00115 'category' => array(t('Form'), -9),
00116 );
00117 }
00118 return $content;
00119 }
00120
00121
00122
00123
00124
00125 function panels_content_node_form($conf, $panel_args, &$context) {
00126 $block = new stdClass();
00127 $block->module = 'node-form';
00128
00129 switch ($conf['id']) {
00130 case 'publishing':
00131 $block->subject = t('Publishing options');
00132 $block->delta = 'publishing-options';
00133
00134 if (isset($context->form)) {
00135 if (!empty($context->form->form_id) && $context->form['options']['#type'] == 'fieldset') {
00136
00137 unset($context->form['options']['#type']);
00138 $block->content = drupal_render($context->form['options']);
00139 }
00140 }
00141 else {
00142 $block->content = t('Publishing options.');
00143 }
00144 break;
00145
00146 case 'comment':
00147 $block->subject = t('Comment options');
00148 $block->delta = 'comment-options';
00149
00150 if (isset($context->form)) {
00151 if (!empty($context->form->form_id) && !empty($context->form['comment_settings']['#access'])) {
00152
00153 unset($context->form['comment_settings']['#type']);
00154 $block->content = drupal_render($context->form['comment_settings']);
00155 }
00156 }
00157 else {
00158 $block->content = t('Comment options.');
00159 }
00160 break;
00161
00162 case 'author':
00163 $block->subject = $block->content = t('Authoring information');
00164 $block->delta = 'author-options';
00165
00166 if (isset($context->form)) {
00167 if (!empty($context->form->form_id) && !empty($context->form['author']['#access'])) {
00168
00169 unset($context->form['author']['#type']);
00170 $context->form['author']['name']['#size'] /= 2;
00171 $context->form['author']['date']['#size'] /= 2;
00172 $block->content = drupal_render($context->form['author']);
00173 }
00174 }
00175 else {
00176 $block->content = t('Authoring information.');
00177 }
00178 break;
00179
00180 case 'menu':
00181 $block->subject = t('Menu options');
00182 $block->delta = 'menu-options';
00183
00184 if (isset($context->form)) {
00185 if (!empty($context->form->form_id) && !empty($context->form['menu']['#access'])) {
00186
00187 unset($context->form['menu']['#type']);
00188 $context->form['menu']['title']['#size'] /= 2;
00189 $context->form['menu']['description']['#size'] /= 2;
00190 $block->content = drupal_render($context->form['menu']);
00191 }
00192 }
00193 else {
00194 $block->content = t('Menu options.');
00195 }
00196 break;
00197
00198 case 'url_path':
00199 $block->subject = t('URL path options');
00200 $block->delta = 'url-path-options';
00201
00202 if (isset($context->form)) {
00203 if (!empty($context->form->form_id) && !empty($context->form['path']['#access'])) {
00204
00205 unset($context->form['path']['#type']);
00206 $context->form['path']['path']['#size'] /= 2;
00207 $block->content = drupal_render($context->form['path']);
00208 }
00209 }
00210 else {
00211 $block->content = t('URL Path options.');
00212 }
00213 break;
00214
00215 case 'attachments':
00216 $block->subject = t('Attach files');
00217 $block->delta = 'url-path-options';
00218
00219 if (isset($context->form)) {
00220 if (!empty($context->form->form_id) && !empty($context->form['attachments']['#access'])) {
00221
00222 unset($context->form['attachments']['#type']);
00223 $block->content = drupal_render($context->form['attachments']);
00224 }
00225 }
00226 else {
00227 $block->content = t('Attach files.');
00228 }
00229 break;
00230
00231 case 'taxonomy':
00232 $block->subject = t('Categories');
00233 $block->delta = 'url-path-options';
00234
00235 if (isset($context->form)) {
00236 if (!empty($context->form->form_id) && !empty($context->form['taxonomy'])) {
00237
00238 unset($context->form['taxonomy']['#type']);
00239 $block->content = drupal_render($context->form['taxonomy']);
00240 }
00241 }
00242 else {
00243 $block->content = t('Categories.');
00244 }
00245 break;
00246
00247 case 'book':
00248 $block->subject = t('Book options');
00249 $block->delta = 'book-options';
00250
00251 if (isset($context->form)) {
00252 if (!empty($context->form->form_id)) {
00253 $block->content = '';
00254 if ($context->form['parent']['#type'] != 'value') {
00255 $block->content .= drupal_render($context->form['parent']);
00256 }
00257 if ($context->form['weight']['#type'] != 'value') {
00258 $block->content .= drupal_render($context->form['weight']);
00259 }
00260 }
00261 }
00262 else {
00263 $block->content = t('Book options.');
00264 }
00265 break;
00266
00267 case 'input_format':
00268 $block->subject = t('Input format');
00269 $block->delta = 'format-options';
00270
00271 if (isset($context->form)) {
00272 if (!empty($context->form->form_id) && !empty($context->form['body_filter']['format'])) {
00273
00274 unset($context->form['body_filter']['format']['#type']);
00275 $block->content = drupal_render($context->form['body_filter']['format']);
00276 }
00277 }
00278 else {
00279 $block->content = t('Input format.');
00280 }
00281 break;
00282 }
00283
00284 return $block;
00285 }
00286
00287
00288
00289
00290 function panels_admin_edit_node_form($id, $parents, $conf = array()) {
00291 $form['id'] = array(
00292 '#type' => 'value',
00293 '#value' => $id,
00294 );
00295
00296 return $form;
00297 }
00298
00299 function panels_admin_title_node_form($conf, $context) {
00300 $choices = panels_admin_content_types_node_form();
00301 return t('"@s" @type', array('@s' => $context->identifier, '@type' => drupal_strtolower($choices[$conf['id']]['title'])));
00302 }
00303