View source
<?php
function multiform_sharedfields_example_page() {
module_load_include('inc', 'node', 'node.pages');
global $user;
$type = 'multiform_base';
$node = (object) array(
'uid' => $user->uid,
'name' => isset($user->name) ? $user->name : '',
'type' => $type,
'language' => LANGUAGE_NONE,
);
$node2 = clone $node;
$node2->type = 'multiform_dependent';
$settings = array(
'#multiform_id' => 'multiform_sharedfields_example',
'#subforms' => array(
array(
'form_id' => 'multiform_base_node_form',
'args' => array(
$node,
),
),
array(
'form_id' => 'multiform_dependent_node_form',
'args' => array(
$node2,
),
),
),
);
return multiform_get_form($settings);
}
function multiform_example_node_form_settings_hide(&$form) {
$groups = array(
'author' => array(
'name',
'date',
),
'options' => array(
'status',
'promote',
'sticky',
),
'comment_settings' => array(
'comment',
),
'revision_information' => array(
'revision',
'log',
),
'path' => array(
'alias',
),
);
foreach ($groups as $k => $group) {
foreach ($group as $v => $option) {
$form[$k][$option]['#type'] = 'value';
$form[$k][$option]['#value'] = $form[$k][$option]['#default_value'];
}
$form[$k]['#type'] = 'container';
$form[$k]['#title'] = '';
}
$form['menu']['#access'] = FALSE;
$form['actions']['preview']['#access'] = FALSE;
}