1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
c304a780
|
Assos Assos
|
* @file
|
5 |
85ad3d82
|
Assos Assos
|
* Plugins are described by creating a $plugin array which will be used
|
6 |
|
|
* by the system that includes this file.
|
7 |
|
|
*/
|
8 |
c304a780
|
Assos Assos
|
|
9 |
85ad3d82
|
Assos Assos
|
$plugin = array(
|
10 |
c304a780
|
Assos Assos
|
// Only provides a single content type.
|
11 |
85ad3d82
|
Assos Assos
|
'single' => TRUE,
|
12 |
|
|
'render last' => TRUE,
|
13 |
|
|
'title' => t('General form'),
|
14 |
|
|
'icon' => 'icon_form.png',
|
15 |
|
|
'description' => t('Everything in the form that is not displayed by other content.'),
|
16 |
|
|
'required context' => new ctools_context_required(t('Form'), 'form'),
|
17 |
|
|
'category' => t('Form'),
|
18 |
|
|
);
|
19 |
|
|
|
20 |
|
|
/**
|
21 |
|
|
* Output function for the 'node' content type. Outputs a node
|
22 |
|
|
* based on the module and delta supplied in the configuration.
|
23 |
|
|
*/
|
24 |
|
|
function ctools_form_content_type_render($subtype, $conf, $panel_args, &$context) {
|
25 |
|
|
$block = new stdClass();
|
26 |
|
|
$block->module = 'form';
|
27 |
|
|
|
28 |
|
|
if (isset($context->form)) {
|
29 |
|
|
if (isset($context->form['#pre_render'])) {
|
30 |
|
|
foreach ($context->form['#pre_render'] as $function) {
|
31 |
|
|
if (function_exists($function)) {
|
32 |
|
|
$context->form = $function($context->form);
|
33 |
|
|
}
|
34 |
|
|
}
|
35 |
|
|
unset($context->form['#pre_render']);
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
$block->title = $context->form_title;
|
39 |
|
|
$block->content = array();
|
40 |
|
|
foreach (element_children($context->form) as $element) {
|
41 |
|
|
$block->content[$element] = $context->form[$element];
|
42 |
|
|
unset($context->form[$element]);
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
$block->delta = $context->form_id;
|
46 |
|
|
}
|
47 |
|
|
else {
|
48 |
c304a780
|
Assos Assos
|
$block->title = t('Form');
|
49 |
85ad3d82
|
Assos Assos
|
$block->content = t('Form goes here.');
|
50 |
|
|
$block->delta = 'unknown';
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
return $block;
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
function ctools_form_content_type_admin_title($subtype, $conf, $context) {
|
57 |
|
|
return t('"@s" base form', array('@s' => $context->identifier));
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
function ctools_form_content_type_edit_form($form, &$form_state) {
|
61 |
c304a780
|
Assos Assos
|
// Provide a blank form so we have a place to override title
|
62 |
85ad3d82
|
Assos Assos
|
// and stuff.
|
63 |
|
|
return $form;
|
64 |
|
|
} |