Add "Mother" asset reference field to Birth logs.

This commit is contained in:
Michael Stenta 2018-02-22 10:40:43 -05:00
parent e38a4ebaf9
commit 1a1c4de007
4 changed files with 124 additions and 15 deletions

View File

@ -204,5 +204,40 @@ function farm_livestock_field_default_field_bases() {
'type' => 'taxonomy_term_reference',
);
// Exported field_base: 'field_farm_mother'.
$field_bases['field_farm_mother'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_farm_mother',
'indexes' => array(
'target_id' => array(
0 => 'target_id',
),
),
'locked' => 0,
'module' => 'entityreference',
'settings' => array(
'handler' => 'base',
'handler_settings' => array(
'behaviors' => array(
'views-select-list' => array(
'status' => 0,
),
),
'sort' => array(
'type' => 'none',
),
'target_bundles' => array(
'animal' => 'animal',
),
),
'target_type' => 'farm_asset',
),
'translatable' => 0,
'type' => 'entityreference',
);
return $field_bases;
}

View File

@ -507,7 +507,7 @@ function farm_livestock_field_default_field_instances() {
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => 4,
'weight' => 5,
),
),
'entity_type' => 'log',
@ -540,7 +540,7 @@ function farm_livestock_field_default_field_instances() {
'link' => 1,
),
'type' => 'entityreference_label',
'weight' => 0,
'weight' => 1,
),
),
'entity_type' => 'log',
@ -578,7 +578,7 @@ function farm_livestock_field_default_field_instances() {
'module' => 'file',
'settings' => array(),
'type' => 'file_table',
'weight' => 9,
'weight' => 10,
),
),
'entity_type' => 'log',
@ -618,7 +618,7 @@ function farm_livestock_field_default_field_instances() {
'map_layer_preset' => 'farm_map_geofield_formatter:openlayers_geofield_layer_formatter',
),
'type' => 'openlayers_geofield',
'weight' => 10,
'weight' => 11,
),
),
'entity_type' => 'log',
@ -688,7 +688,7 @@ function farm_livestock_field_default_field_instances() {
'colorbox_node_style_first' => 'large',
),
'type' => 'colorbox',
'weight' => 8,
'weight' => 9,
),
),
'entity_type' => 'log',
@ -732,7 +732,7 @@ function farm_livestock_field_default_field_instances() {
'view_mode' => 'full',
),
'type' => 'field_collection_fields',
'weight' => 3,
'weight' => 4,
),
),
'entity_type' => 'log',
@ -767,7 +767,7 @@ function farm_livestock_field_default_field_instances() {
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => 6,
'weight' => 7,
),
),
'entity_type' => 'log',
@ -801,7 +801,7 @@ function farm_livestock_field_default_field_instances() {
'link' => FALSE,
),
'type' => 'entityreference_label',
'weight' => 7,
'weight' => 8,
),
),
'entity_type' => 'log',
@ -834,7 +834,7 @@ function farm_livestock_field_default_field_instances() {
'view_mode' => 'full',
),
'type' => 'field_collection_fields',
'weight' => 2,
'weight' => 3,
),
),
'entity_type' => 'log',
@ -853,6 +853,47 @@ function farm_livestock_field_default_field_instances() {
),
);
// Exported field_instance: 'log-farm_birth-field_farm_mother'.
$field_instances['log-farm_birth-field_farm_mother'] = array(
'bundle' => 'farm_birth',
'deleted' => 0,
'description' => 'Link this birth log to a mother animal so that you can easily see all birth logs for that animal on their record.',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'entityreference',
'settings' => array(
'bypass_access' => 0,
'link' => 1,
),
'type' => 'entityreference_label',
'weight' => 0,
),
),
'entity_type' => 'log',
'field_name' => 'field_farm_mother',
'label' => 'Mother',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference_view_widget',
'settings' => array(
'allow_duplicates' => 0,
'close_modal' => 1,
'pass_argument' => 1,
'pass_arguments' => '',
'rendered_entity' => 0,
'view' => 'farm_asset_entityreference_view|entityreference_view_widget',
'view_mode' => 'full',
),
'type' => 'entityreference_view_widget',
'weight' => 23,
),
);
// Exported field_instance: 'log-farm_birth-field_farm_movement'.
$field_instances['log-farm_birth-field_farm_movement'] = array(
'bundle' => 'farm_birth',
@ -867,7 +908,7 @@ function farm_livestock_field_default_field_instances() {
'view_mode' => 'full',
),
'type' => 'field_collection_fields',
'weight' => 1,
'weight' => 2,
),
),
'entity_type' => 'log',
@ -898,7 +939,7 @@ function farm_livestock_field_default_field_instances() {
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 5,
'weight' => 6,
),
),
'entity_type' => 'log',
@ -1232,9 +1273,11 @@ function farm_livestock_field_default_field_instances() {
t('ID');
t('ID Tag(s)');
t('Inventory adjustments');
t('Link this birth log to a mother animal so that you can easily see all birth logs for that animal on their record.');
t('List any identification tags that this animal has. These can be ear tags, tattoos, leg bands, etc. Use the fields below to describe the type, location, and ID of each.');
t('List any nickname(s) of this animal.');
t('Log category');
t('Mother');
t('Movement');
t('Nickname(s)');
t('Notes');

View File

@ -137,7 +137,7 @@ function farm_livestock_field_group_info() {
$field_group->parent_name = 'group_farm_tabs';
$field_group->data = array(
'label' => 'Children',
'weight' => '5',
'weight' => '6',
'children' => array(
0 => 'field_farm_asset',
1 => 'field_farm_movement',
@ -193,7 +193,7 @@ function farm_livestock_field_group_info() {
$field_group->parent_name = 'group_farm_tabs';
$field_group->data = array(
'label' => 'Files',
'weight' => '8',
'weight' => '9',
'children' => array(
0 => 'field_farm_files',
1 => 'field_farm_images',
@ -426,7 +426,7 @@ function farm_livestock_field_group_info() {
$field_group->parent_name = 'group_farm_tabs';
$field_group->data = array(
'label' => 'Inventory',
'weight' => '7',
'weight' => '8',
'children' => array(
0 => 'field_farm_inventory',
),
@ -506,7 +506,7 @@ function farm_livestock_field_group_info() {
$field_group->parent_name = 'group_farm_tabs';
$field_group->data = array(
'label' => 'Location',
'weight' => '6',
'weight' => '7',
'children' => array(
0 => 'field_farm_area',
1 => 'group_farm_geometry',
@ -548,6 +548,32 @@ function farm_livestock_field_group_info() {
);
$field_groups['group_farm_location|log|farm_medical|form'] = $field_group;
$field_group = new stdClass();
$field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
$field_group->api_version = 1;
$field_group->identifier = 'group_farm_mother|log|farm_birth|form';
$field_group->group_name = 'group_farm_mother';
$field_group->entity_type = 'log';
$field_group->bundle = 'farm_birth';
$field_group->mode = 'form';
$field_group->parent_name = 'group_farm_tabs';
$field_group->data = array(
'label' => 'Mother',
'weight' => '5',
'children' => array(
0 => 'field_farm_mother',
),
'format_type' => 'field_group_easy_responsive_tabs_nav_item',
'format_settings' => array(
'formatter' => '',
'instance_settings' => array(
'classes' => 'group-farm-mother field-group-field_group_easy_responsive_tabs_nav_item',
'required_fields' => 1,
),
),
);
$field_groups['group_farm_mother|log|farm_birth|form'] = $field_group;
$field_group = new stdClass();
$field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
$field_group->api_version = 1;
@ -604,6 +630,7 @@ function farm_livestock_field_group_info() {
2 => 'group_farm_inventory',
3 => 'group_farm_children',
4 => 'group_farm_location',
5 => 'group_farm_mother',
),
'format_type' => 'field_group_easy_responsive_tabs_nav',
'format_settings' => array(
@ -677,6 +704,7 @@ function farm_livestock_field_group_info() {
t('Inventory');
t('Lineage');
t('Location');
t('Mother');
t('Tabs');
return $field_groups;

View File

@ -51,6 +51,7 @@ features[field_base][] = field_farm_animal_tag_id
features[field_base][] = field_farm_animal_tag_location
features[field_base][] = field_farm_animal_tag_type
features[field_base][] = field_farm_animal_type
features[field_base][] = field_farm_mother
features[field_group][] = group_farm_assignment|log|farm_birth|form
features[field_group][] = group_farm_assignment|log|farm_medical|form
features[field_group][] = group_farm_category|log|farm_birth|form
@ -70,6 +71,7 @@ features[field_group][] = group_farm_inventory|log|farm_medical|form
features[field_group][] = group_farm_lineage|farm_asset|animal|form
features[field_group][] = group_farm_location|log|farm_birth|form
features[field_group][] = group_farm_location|log|farm_medical|form
features[field_group][] = group_farm_mother|log|farm_birth|form
features[field_group][] = group_farm_tabs|farm_asset|animal|form
features[field_group][] = group_farm_tabs|log|farm_birth|form
features[field_group][] = group_farm_tabs|log|farm_medical|form
@ -95,6 +97,7 @@ features[field_instance][] = log-farm_birth-field_farm_inventory
features[field_instance][] = log-farm_birth-field_farm_log_category
features[field_instance][] = log-farm_birth-field_farm_log_owner
features[field_instance][] = log-farm_birth-field_farm_membership
features[field_instance][] = log-farm_birth-field_farm_mother
features[field_instance][] = log-farm_birth-field_farm_movement
features[field_instance][] = log-farm_birth-field_farm_notes
features[field_instance][] = log-farm_medical-field_farm_asset