function field_tools_get_field_code in Field tools 7
Retrieve a code representation of the given field instance.
Parameters
array $instance: A field instance array.
Return value
string The code representation of the field instance.
2 calls to field_tools_get_field_code()
- field_tools_bundle_export_form in ./
field_tools.admin.inc - Form to export all fields of a bundle.
- field_tools_field_export_form in ./
field_tools.admin.inc - Form to export a single field instance.
File
- ./
field_tools.admin.inc, line 947 - Contains admin callbacks for the Field tools module.
Code
function field_tools_get_field_code($instance) {
$data = array();
$entity_name = $instance['entity_type'];
$bundle_name = $instance['bundle'];
$field_name = $instance['field_name'];
$data[$field_name] = array(
'field' => field_info_field($field_name),
'instance' => field_info_instance($entity_name, $field_name, $bundle_name),
);
ctools_include('export');
return '$fields[\'' . $field_name . '\'] = ' . ctools_var_export($data[$field_name]) . ';';
}