Initil commit: basic Animal asset type, Breeds vocabulary, and ID Tag field collection.

This commit is contained in:
Michael Stenta 2014-11-12 14:27:59 -05:00
commit cf9824be5c
6 changed files with 945 additions and 0 deletions

View File

@ -0,0 +1,771 @@
<?php
/**
* @file
* farm_livestock.features.field.inc
*/
/**
* Implements hook_field_default_fields().
*/
function farm_livestock_field_default_fields() {
$fields = array();
// Exported field: 'farm_asset-animal-field_farm_animal_breed'.
$fields['farm_asset-animal-field_farm_animal_breed'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_breed',
'foreign keys' => array(
'tid' => array(
'columns' => array(
'tid' => 'tid',
),
'table' => 'taxonomy_term_data',
),
),
'indexes' => array(
'tid' => array(
0 => 'tid',
),
),
'locked' => '0',
'module' => 'taxonomy',
'settings' => array(
'allowed_values' => array(
0 => array(
'vocabulary' => 'farm_animal_breeds',
'parent' => '0',
),
),
),
'translatable' => '0',
'type' => 'taxonomy_term_reference',
),
'field_instance' => array(
'bundle' => 'animal',
'default_value' => NULL,
'deleted' => '0',
'description' => 'What breed is this animal? You can manage the list of available breeds in the <a href="/admin/structure/taxonomy/farm_animal_breeds">Breeds Vocabulary</a>.',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => '3',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_animal_breed',
'label' => 'Breed',
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => '3',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_animal_description'.
$fields['farm_asset-animal-field_farm_animal_description'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_description',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => '0',
'module' => 'text',
'settings' => array(),
'translatable' => '0',
'type' => 'text_long',
),
'field_instance' => array(
'bundle' => 'animal',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => '7',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_animal_description',
'label' => 'Description',
'required' => 0,
'settings' => array(
'text_processing' => '0',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'rows' => '5',
),
'type' => 'text_textarea',
'weight' => '7',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_animal_nicknames'.
$fields['farm_asset-animal-field_farm_animal_nicknames'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '-1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_nicknames',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => '0',
'module' => 'text',
'settings' => array(
'max_length' => '255',
),
'translatable' => '0',
'type' => 'text',
),
'field_instance' => array(
'bundle' => 'animal',
'default_value' => NULL,
'deleted' => '0',
'description' => 'List any nickname(s) of this animal.',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => '1',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_animal_nicknames',
'label' => 'Nickname(s)',
'required' => 0,
'settings' => array(
'text_processing' => '0',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'size' => '60',
),
'type' => 'text_textfield',
'weight' => '1',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_animal_parents'.
$fields['farm_asset-animal-field_farm_animal_parents'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '2',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_parents',
'foreign keys' => array(
'farm_asset' => array(
'columns' => array(
'target_id' => 'id',
),
'table' => 'farm_asset',
),
),
'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',
),
'field_instance' => array(
'bundle' => 'animal',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'entityreference',
'settings' => array(
'link' => FALSE,
),
'type' => 'entityreference_label',
'weight' => '6',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_animal_parents',
'label' => 'Parents',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => '60',
),
'type' => 'entityreference_autocomplete',
'weight' => '6',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_animal_sex'.
$fields['farm_asset-animal-field_farm_animal_sex'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_sex',
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => '0',
'module' => 'list',
'settings' => array(
'allowed_values' => array(
'F' => 'Female',
'M' => 'Male',
),
'allowed_values_function' => '',
),
'translatable' => '0',
'type' => 'list_text',
),
'field_instance' => array(
'bundle' => 'animal',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'list',
'settings' => array(),
'type' => 'list_default',
'weight' => '4',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_animal_sex',
'label' => 'Sex',
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => '4',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_animal_tag'.
$fields['farm_asset-animal-field_farm_animal_tag'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '-1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_tag',
'foreign keys' => array(),
'indexes' => array(
'revision_id' => array(
0 => 'revision_id',
),
),
'locked' => '0',
'module' => 'field_collection',
'settings' => array(
'hide_blank_items' => 1,
'path' => '',
),
'translatable' => '0',
'type' => 'field_collection',
),
'field_instance' => array(
'bundle' => 'animal',
'default_value' => NULL,
'deleted' => '0',
'description' => '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.',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'field_collection',
'settings' => array(
'view_mode' => 'full',
),
'type' => 'field_collection_fields',
'weight' => '2',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_animal_tag',
'label' => 'ID Tag(s)',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'field_collection',
'settings' => array(),
'type' => 'field_collection_embed',
'weight' => '2',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_date'.
$fields['farm_asset-animal-field_farm_date'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_date',
'foreign keys' => array(),
'indexes' => array(),
'locked' => '0',
'module' => 'date',
'settings' => array(
'cache_count' => '4',
'cache_enabled' => 0,
'granularity' => array(
'day' => 'day',
'hour' => 0,
'minute' => 0,
'month' => 'month',
'second' => 0,
'year' => 'year',
),
'repeat' => '0',
'timezone_db' => '',
'todate' => '',
'tz_handling' => 'none',
),
'translatable' => '0',
'type' => 'datestamp',
),
'field_instance' => array(
'bundle' => 'animal',
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'date',
'settings' => array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
'show_repeat_rule' => 'show',
),
'type' => 'date_default',
'weight' => '5',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_date',
'label' => 'Date of birth',
'required' => 0,
'settings' => array(
'default_value' => 'now',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'date',
'settings' => array(
'increment' => '15',
'input_format' => 'M j Y - g:i:sa',
'input_format_custom' => '',
'label_position' => 'above',
'repeat_collapsed' => 0,
'text_parts' => array(),
'year_range' => '-3:+3',
),
'type' => 'date_popup',
'weight' => '5',
),
),
);
// Exported field: 'farm_asset-animal-field_farm_images'.
$fields['farm_asset-animal-field_farm_images'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '-1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_images',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => '0',
'module' => 'image',
'settings' => array(
'default_image' => 0,
'uri_scheme' => 'public',
),
'translatable' => '0',
'type' => 'image',
),
'field_instance' => array(
'bundle' => 'animal',
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'image',
'settings' => array(
'image_link' => 'file',
'image_style' => 'medium',
),
'type' => 'image',
'weight' => '0',
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_images',
'label' => 'Photo(s)',
'required' => 0,
'settings' => array(
'alt_field' => 0,
'default_image' => 0,
'file_directory' => '',
'file_extensions' => 'png gif jpg jpeg',
'filefield_paths' => array(
'active_updating' => 0,
'file_name' => array(
'options' => array(
'pathauto' => 0,
'transliterate' => 0,
),
'value' => '[file:ffp-name-only-original].[file:ffp-extension-original]',
),
'file_path' => array(
'options' => array(
'pathauto' => 0,
'transliterate' => 0,
),
'value' => 'farm/animals/[farm_asset:id]',
),
'retroactive_update' => 0,
),
'filefield_paths_enabled' => 1,
'max_filesize' => '',
'max_resolution' => '',
'min_resolution' => '',
'title_field' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'image',
'settings' => array(
'preview_image_style' => 'thumbnail',
'progress_indicator' => 'bar',
),
'type' => 'image_image',
'weight' => '8',
),
),
);
// Exported field: 'field_collection_item-field_farm_animal_tag-field_farm_animal_tag_id'.
$fields['field_collection_item-field_farm_animal_tag-field_farm_animal_tag_id'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_tag_id',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => '0',
'module' => 'text',
'settings' => array(
'max_length' => '255',
),
'translatable' => '0',
'type' => 'text',
),
'field_instance' => array(
'bundle' => 'field_farm_animal_tag',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 0,
),
),
'entity_type' => 'field_collection_item',
'field_name' => 'field_farm_animal_tag_id',
'label' => 'ID',
'required' => 0,
'settings' => array(
'text_processing' => '0',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'size' => '60',
),
'type' => 'text_textfield',
'weight' => '1',
),
),
);
// Exported field: 'field_collection_item-field_farm_animal_tag-field_farm_animal_tag_location'.
$fields['field_collection_item-field_farm_animal_tag-field_farm_animal_tag_location'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_tag_location',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => '0',
'module' => 'text',
'settings' => array(
'max_length' => '255',
),
'translatable' => '0',
'type' => 'text',
),
'field_instance' => array(
'bundle' => 'field_farm_animal_tag',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 1,
),
),
'entity_type' => 'field_collection_item',
'field_name' => 'field_farm_animal_tag_location',
'label' => 'Body Location',
'required' => 0,
'settings' => array(
'text_processing' => '0',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'size' => '60',
),
'type' => 'text_textfield',
'weight' => '3',
),
),
);
// Exported field: 'field_collection_item-field_farm_animal_tag-field_farm_animal_tag_type'.
$fields['field_collection_item-field_farm_animal_tag-field_farm_animal_tag_type'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_animal_tag_type',
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => '0',
'module' => 'list',
'settings' => array(
'allowed_values' => array(
'Brand' => 'Brand',
'Ear tag' => 'Ear tag',
'Tattoo' => 'Tattoo',
'Leg band' => 'Leg band',
),
'allowed_values_function' => '',
),
'translatable' => '0',
'type' => 'list_text',
),
'field_instance' => array(
'bundle' => 'field_farm_animal_tag',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'list',
'settings' => array(),
'type' => 'list_default',
'weight' => 2,
),
),
'entity_type' => 'field_collection_item',
'field_name' => 'field_farm_animal_tag_type',
'label' => 'Tag Type',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => '2',
),
),
);
// Translatables
// Included for use with string extractors like potx.
t('Body Location');
t('Breed');
t('Date of birth');
t('Description');
t('ID');
t('ID Tag(s)');
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('Nickname(s)');
t('Parents');
t('Photo(s)');
t('Sex');
t('Tag Type');
t('What breed is this animal? You can manage the list of available breeds in the <a href="/admin/structure/taxonomy/farm_animal_breeds">Breeds Vocabulary</a>.');
return $fields;
}

View File

@ -0,0 +1,29 @@
<?php
/**
* @file
* farm_livestock.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function farm_livestock_ctools_plugin_api() {
list($module, $api) = func_get_args();
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_default_farm_asset_type().
*/
function farm_livestock_default_farm_asset_type() {
$items = array();
$items['animal'] = entity_import('farm_asset_type', '{
"type" : "animal",
"label" : "Animal",
"weight" : 0,
"rdf_mapping" : []
}');
return $items;
}

View File

@ -0,0 +1,36 @@
<?php
/**
* @file
* farm_livestock.features.taxonomy.inc
*/
/**
* Implements hook_taxonomy_default_vocabularies().
*/
function farm_livestock_taxonomy_default_vocabularies() {
return array(
'farm_animal_breeds' => array(
'name' => 'Farm Animal Breeds',
'machine_name' => 'farm_animal_breeds',
'description' => 'A vocabulary of farm animal breeds.',
'hierarchy' => '0',
'module' => 'taxonomy',
'weight' => '0',
'rdf_mapping' => array(
'rdftype' => array(
0 => 'skos:ConceptScheme',
),
'name' => array(
'predicates' => array(
0 => 'dc:title',
),
),
'description' => array(
'predicates' => array(
0 => 'rdfs:comment',
),
),
),
),
);
}

37
farm_livestock.info Normal file
View File

@ -0,0 +1,37 @@
name = Farm Livestock
description = Features for managing farm livestock.
core = 7.x
package = Farm
dependencies[] = ctools
dependencies[] = date
dependencies[] = entity
dependencies[] = entityreference
dependencies[] = farm_asset
dependencies[] = features
dependencies[] = field_collection
dependencies[] = field_sql_storage
dependencies[] = filefield_paths
dependencies[] = image
dependencies[] = list
dependencies[] = options
dependencies[] = strongarm
dependencies[] = taxonomy
dependencies[] = text
features[ctools][] = strongarm:strongarm:1
features[farm_asset_type][] = animal
features[features_api][] = api:1
features[field][] = farm_asset-animal-field_farm_animal_breed
features[field][] = farm_asset-animal-field_farm_animal_description
features[field][] = farm_asset-animal-field_farm_animal_nicknames
features[field][] = farm_asset-animal-field_farm_animal_parents
features[field][] = farm_asset-animal-field_farm_animal_sex
features[field][] = farm_asset-animal-field_farm_animal_tag
features[field][] = farm_asset-animal-field_farm_date
features[field][] = farm_asset-animal-field_farm_images
features[field][] = field_collection_item-field_farm_animal_tag-field_farm_animal_tag_id
features[field][] = field_collection_item-field_farm_animal_tag-field_farm_animal_tag_location
features[field][] = field_collection_item-field_farm_animal_tag-field_farm_animal_tag_type
features[taxonomy][] = farm_animal_breeds
features[variable][] = field_bundle_settings_farm_asset__animal
features[variable][] = field_bundle_settings_field_collection_item__field_farm_animal_tag
features[variable][] = pathauto_taxonomy_term_farm_animal_breeds_pattern

7
farm_livestock.module Normal file
View File

@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Farm Livestock feature.
*/
include_once 'farm_livestock.features.inc';

View File

@ -0,0 +1,65 @@
<?php
/**
* @file
* farm_livestock.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function farm_livestock_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_farm_asset__animal';
$strongarm->value = array(
'view_modes' => array(
'full' => array(
'custom_settings' => FALSE,
),
'token' => array(
'custom_settings' => FALSE,
),
),
'extra_fields' => array(
'form' => array(
'name' => array(
'weight' => '0',
),
'redirect' => array(
'weight' => '9',
),
),
'display' => array(),
),
);
$export['field_bundle_settings_farm_asset__animal'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_field_collection_item__field_farm_animal_tag';
$strongarm->value = array(
'view_modes' => array(),
'extra_fields' => array(
'form' => array(
'redirect' => array(
'weight' => '0',
),
),
'display' => array(),
),
);
$export['field_bundle_settings_field_collection_item__field_farm_animal_tag'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'pathauto_taxonomy_term_farm_animal_breeds_pattern';
$strongarm->value = 'farm/animal/breed/[term:name]';
$export['pathauto_taxonomy_term_farm_animal_breeds_pattern'] = $strongarm;
return $export;
}