function viewfield_field_settings in Viewfield 6.2
Same name and namespace in other branches
- 5 viewfield.module \viewfield_field_settings()
- 6 viewfield.module \viewfield_field_settings()
Implementation of hook_field_settings().
File
- ./
viewfield.module, line 31 - Core functions.
Code
function viewfield_field_settings($op, $field) {
switch ($op) {
case 'form':
$form['allowed_views'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed values'),
'#default_value' => is_array($field['allowed_views']) ? $field['allowed_views'] : array(),
'#options' => drupal_map_assoc(array_keys(views_get_all_views())),
'#description' => t('Only selected views will be available for content authors. Leave empty to allow all.'),
);
return $form;
case 'validate':
if ($field['force_default'] && $field['multiple']) {
form_set_error('multiple', t('Multiple views are not supported if force default is enabled.'));
}
break;
case 'save':
return array(
'allowed_views',
);
case 'database columns':
return array(
// Views requires at least 96 chars for the view name and display, plus
// we need 1 for our delimiter. Round up to a common value of 128.
'vname' => array(
'type' => 'varchar',
'not null' => FALSE,
'length' => 128,
),
'vargs' => array(
'type' => 'varchar',
'not null' => FALSE,
'length' => 255,
),
);
}
}