function title_field_replacement_form in Title 7
Generate a field replacement form.
1 string reference to 'title_field_replacement_form'
- title_menu in ./
title.module - Implements hook_menu().
File
- ./
title.admin.inc, line 34 - Admin page callbacks for the Title module.
Code
function title_field_replacement_form($form, $form_state, $entity_type, $bundle, $field_name) {
$bundle_name = field_extract_bundle($entity_type, $bundle);
$entity_info = entity_get_info($entity_type);
$info = $entity_info['field replacement'][$field_name];
$instance = field_info_instance($entity_type, $info['field']['field_name'], $bundle_name);
$enabled = !empty($instance);
$form['#entity_type'] = $entity_type;
$form['#bundle'] = $bundle_name;
$form['#field_name'] = $field_name;
$form['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Replace %field with a field instance', array(
'%field' => $field_name,
)),
'#description' => t('If this is enabled the %field will be replaced with a customizable field that can be translated.', array(
'%field' => $field_name,
)),
'#default_value' => $enabled,
'#disabled' => $enabled,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
return $form;
}