form.inc

Go to the documentation of this file.
00001 <?php
00002 // $Id: form.inc,v 1.1.2.8 2008/05/27 20:21:11 sdboyer Exp $
00003 
00004 
00005 /**
00006  * Callback function to supply a list of content types.
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     // only provides a single content type
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  * Return all content types available.
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  * Output function for the 'node' content type. Outputs a node
00041  * based on the module and delta supplied in the configuration.
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       // If this is a form, drupal_render it.
00051       $block->content = drupal_render($context->form);
00052     }
00053     else {
00054       // Otherwise just spit back what we were given. This is probably an
00055       // error message or something.
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 

Generated on Sun Feb 5 05:00:12 2012 for Panels 2 by  doxygen 1.5.6