You are here

function panels_content_node_form in Panels 6.2

Same name and namespace in other branches
  1. 5.2 content_types/node_form.inc \panels_content_node_form()
1 string reference to 'panels_content_node_form'
panels_node_form_panels_content_types in content_types/node_form.inc
Callback function to supply a list of content types.

File

content_types/node_form.inc, line 120

Code

function panels_content_node_form($subtype, $conf, $panel_args, &$context) {
  $block = new stdClass();
  $block->module = 'node-form';
  switch ($conf['id']) {
    case 'publishing':
      $block->subject = t('Publishing options');
      $block->delta = 'publishing-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && $context->form['options']['#type'] == 'fieldset') {

          // remove the fieldset
          unset($context->form['options']['#type']);
          $block->content = drupal_render($context->form['options']);
        }
      }
      else {
        $block->content = t('Publishing options.');
      }
      break;
    case 'comment':
      $block->subject = t('Comment options');
      $block->delta = 'comment-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['comment_settings']['#access'])) {

          // remove the fieldset
          unset($context->form['comment_settings']['#type']);
          $block->content = drupal_render($context->form['comment_settings']);
        }
      }
      else {
        $block->content = t('Comment options.');
      }
      break;
    case 'author':
      $block->subject = $block->content = t('Authoring information');
      $block->delta = 'author-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['author']['#access'])) {

          // remove the fieldset
          unset($context->form['author']['#type']);
          $context->form['author']['name']['#size'] /= 2;
          $context->form['author']['date']['#size'] /= 2;
          $block->content = drupal_render($context->form['author']);
        }
      }
      else {
        $block->content = t('Authoring information.');
      }
      break;
    case 'menu':
      $block->subject = t('Menu options');
      $block->delta = 'menu-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['menu']['#access'])) {

          // remove the fieldset
          unset($context->form['menu']['#type']);
          $context->form['menu']['title']['#size'] /= 2;
          $context->form['menu']['description']['#size'] /= 2;
          $block->content = drupal_render($context->form['menu']);
        }
      }
      else {
        $block->content = t('Menu options.');
      }
      break;
    case 'url_path':
      $block->subject = t('URL path options');
      $block->delta = 'url-path-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['path']['#access'])) {

          // remove the fieldset
          unset($context->form['path']['#type']);
          $context->form['path']['path']['#size'] /= 2;
          $block->content = drupal_render($context->form['path']);
        }
      }
      else {
        $block->content = t('URL Path options.');
      }
      break;
    case 'attachments':
      $block->subject = t('Attach files');
      $block->delta = 'url-path-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['attachments']['#access'])) {

          // remove the fieldset
          unset($context->form['attachments']['#type']);
          $block->content = drupal_render($context->form['attachments']);
        }
      }
      else {
        $block->content = t('Attach files.');
      }
      break;
    case 'taxonomy':
      $block->subject = t('Categories');
      $block->delta = 'url-path-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['taxonomy'])) {

          // remove the fieldset
          unset($context->form['taxonomy']['#type']);
          $block->content = drupal_render($context->form['taxonomy']);
        }
      }
      else {
        $block->content = t('Categories.');
      }
      break;
    case 'book':
      $block->subject = t('Book options');
      $block->delta = 'book-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id)) {
          $block->content = '';
          if ($context->form['parent']['#type'] != 'value') {
            $block->content .= drupal_render($context->form['parent']);
          }
          if ($context->form['weight']['#type'] != 'value') {
            $block->content .= drupal_render($context->form['weight']);
          }
        }
      }
      else {
        $block->content = t('Book options.');
      }
      break;
    case 'input_format':
      $block->subject = t('Input format');
      $block->delta = 'format-options';
      if (isset($context->form)) {
        if (!empty($context->form->form_id) && !empty($context->form['body_filter']['format'])) {

          // remove the fieldset
          unset($context->form['body_filter']['format']['#type']);
          $block->content = drupal_render($context->form['body_filter']['format']);
        }
      }
      else {
        $block->content = t('Input format.');
      }
      break;
  }
  return $block;
}