form.inc
Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008 function panels_form_panels_content_types() {
00009 $items['form'] = array(
00010 'title' => t('Generic form'),
00011 'content_types' => 'panels_admin_content_types_form',
00012
00013 'single' => TRUE,
00014 'render callback' => 'panels_content_form',
00015 'add callback' => 'panels_admin_edit_form',
00016 'edit callback' => 'panels_admin_edit_form',
00017 'title callback' => 'panels_admin_title_form',
00018 'render last' => TRUE,
00019 );
00020 return $items;
00021 }
00022
00023
00024
00025
00026 function panels_admin_content_types_form() {
00027 return array(
00028 'node_type' => array(
00029 'title' => t('General form'),
00030 'icon' => 'icon_node.png',
00031 'path' => panels_get_path('content_types/node'),
00032 'description' => t('The general parts of a form.'),
00033 'required context' => new panels_required_context(t('Form'), 'form'),
00034 'category' => array(t('Form'), -9),
00035 ),
00036 );
00037 }
00038
00039
00040
00041
00042
00043 function panels_content_form($conf, $panel_args, &$context) {
00044 $block = new stdClass();
00045 $block->module = 'form';
00046
00047 if (isset($context->form)) {
00048 $block->subject = $context->form_title;
00049 if (!empty($context->form_id)) {
00050
00051 $block->content = drupal_render($context->form);
00052 }
00053 else {
00054
00055
00056 $block->content = $context->form;
00057 }
00058 $block->delta = $context->form_id;
00059 }
00060 else {
00061 $block->subject = t('Form');
00062 $block->content = t('Form goes here.');
00063 $block->delta = 'unknown';
00064 }
00065
00066 return $block;
00067 }
00068
00069 function panels_admin_title_form($conf, $context) {
00070 return t('"@s" base form', array('@s' => $context->identifier));
00071 }
00072