function text_widget_settings in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 5 text.module \text_widget_settings()
- 6 examples/simple_field.php \text_widget_settings()
- 6 examples/example_field.php \text_widget_settings()
- 6 modules/text/text.module \text_widget_settings()
- 6.2 modules/text/text.module \text_widget_settings()
Implementation of hook_widget_settings().
File
- modules/
text/ text.module, line 310 - Defines simple text field types.
Code
function text_widget_settings($op, $widget) {
switch ($op) {
case 'form':
$form = array();
$rows = isset($widget['rows']) && is_numeric($widget['rows']) ? $widget['rows'] : 5;
$size = isset($widget['size']) && is_numeric($widget['size']) ? $widget['size'] : 60;
if ($widget['type'] == 'text_textfield') {
$form['rows'] = array(
'#type' => 'hidden',
'#value' => $rows,
);
$form['size'] = array(
'#type' => 'textfield',
'#title' => t('Size of textfield'),
'#default_value' => $size,
'#element_validate' => array(
'_element_validate_integer_positive',
),
'#required' => TRUE,
);
}
else {
$form['rows'] = array(
'#type' => 'textfield',
'#title' => t('Rows'),
'#default_value' => $rows,
'#element_validate' => array(
'_element_validate_integer_positive',
),
'#required' => TRUE,
);
$form['size'] = array(
'#type' => 'hidden',
'#value' => $size,
);
}
return $form;
case 'save':
return array(
'rows',
'size',
);
}
}