function subform_widget_settings in Subform 5
File
- ./
subform.module, line 91
Code
function subform_widget_settings($op, $widget) {
switch ($op) {
case 'callbacks':
return array(
'default value' => '_none_',
);
// settings form to be displayed during field creation.
case 'form':
$form = array(
'relation_class' => array(
'#type' => 'select',
'#title' => t('Relation Class'),
'#required' => TRUE,
'#default_value' => isset($widget['relation_class']) ? $widget['relation_class'] : null,
'#options' => relation_class_extended_list(),
'#suffix' => l("Manage Relation Classes", "node/manage/relation_class"),
),
'child_side' => array(
'#type' => 'select',
'#title' => t('Child Node Side'),
'#required' => TRUE,
'#default_value' => isset($widget['child_side']) ? $widget['child_side'] : null,
'#suffix' => "Whatever relation class you have selected, determines what node types can be at the left and right ends of a relation instance based off of that relation class. Subform allows on-the-fly creation and referencing of child nodes, but it must know what *type* of child nodes to create.",
'#options' => array(
"left" => "Left",
"right" => "Right",
),
),
'children_display_mode' => array(
'#type' => 'select',
'#title' => t('Children Display Mode'),
'#required' => TRUE,
'#default_value' => isset($widget['children_display_mode']) ? $widget['children_display_mode'] : "edit",
'#options' => array(
"edit" => "Edit",
"view" => "View",
"hide" => "Hide",
),
),
'allow_hoisting' => array(
'#type' => 'select',
'#title' => t('Allow Hoisting'),
'#required' => TRUE,
'#default_value' => isset($widget['allow_hoisting']) ? $widget['allow_hoisting'] : "no",
'#options' => array(
"yes" => "Yes",
"no" => "No",
),
),
'allow_selection' => array(
'#type' => 'select',
'#title' => t('Allow Selection of Existing Records'),
'#required' => TRUE,
'#default_value' => isset($widget['allow_selection']) ? $widget['allow_selection'] : "yes",
'#options' => array(
"yes" => "Yes",
"no" => "No",
),
),
'selection_query' => array(
'#type' => 'textarea',
'#title' => t('Selection Query'),
'#required' => FALSE,
'#default_value' => isset($widget['selection_query']) ? $widget['selection_query'] : "\n SELECT\n nid, title\n FROM\n {node}\n WHERE\n type = 'SOME CONTENT TYPE'\n ",
'#suffix' => "The results of this query will be displayed as a table except that previously-referenced entries will not be displayed. Be aware that an nid field is required.",
),
);
return $form;
// form keys to save for settings form.
case 'save':
return array(
'relation_class',
'child_side',
'children_display_mode',
'allow_selection',
'allow_hoisting',
'selection_query',
);
}
}