3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Initial commit: moved crops vocabulary and fields from farm_taxonomy module.

This commit is contained in:
Michael Stenta 2014-03-31 10:10:39 -04:00
commit 7abc6d02b5
7 changed files with 599 additions and 0 deletions

View file

@ -0,0 +1,350 @@
<?php
/**
* @file
* farm_crop.features.field.inc
*/
/**
* Implements hook_field_default_fields().
*/
function farm_crop_field_default_fields() {
$fields = array();
// Exported field: 'taxonomy_term-farm_crops-field_farm_companions'.
$fields['taxonomy_term-farm_crops-field_farm_companions'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '-1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_companions',
'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_crops',
'parent' => '0',
),
),
),
'translatable' => '0',
'type' => 'taxonomy_term_reference',
),
'field_instance' => array(
'bundle' => 'farm_crops',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => '1',
),
),
'entity_type' => 'taxonomy_term',
'field_name' => 'field_farm_companions',
'label' => 'Companions',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'taxonomy',
'settings' => array(
'autocomplete_path' => 'taxonomy/autocomplete',
'size' => 60,
),
'type' => 'taxonomy_autocomplete',
'weight' => '3',
),
),
);
// Exported field: 'taxonomy_term-farm_crops-field_farm_crop_family'.
$fields['taxonomy_term-farm_crops-field_farm_crop_family'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_crop_family',
'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' => 'farm_crops',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => '0',
),
),
'entity_type' => 'taxonomy_term',
'field_name' => 'field_farm_crop_family',
'label' => 'Crop family',
'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' => '2',
),
),
);
// Exported field: 'taxonomy_term-farm_crops-field_farm_files'.
$fields['taxonomy_term-farm_crops-field_farm_files'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '-1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_files',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => '0',
'module' => 'file',
'settings' => array(
'display_default' => 0,
'display_field' => 0,
'uri_scheme' => 'public',
),
'translatable' => '0',
'type' => 'file',
),
'field_instance' => array(
'bundle' => 'farm_crops',
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'file',
'settings' => array(),
'type' => 'file_table',
'weight' => '5',
),
),
'entity_type' => 'taxonomy_term',
'field_name' => 'field_farm_files',
'label' => 'Files',
'required' => 0,
'settings' => array(
'description_field' => 1,
'file_directory' => '',
'file_extensions' => 'csv doc docx odt odp ods pdf ppt pptx txt xls xlsx',
'max_filesize' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'file',
'settings' => array(
'progress_indicator' => 'throbber',
),
'type' => 'file_generic',
'weight' => '4',
),
),
);
// Exported field: 'taxonomy_term-farm_crops-field_farm_images'.
$fields['taxonomy_term-farm_crops-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' => 'farm_crops',
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'image',
'settings' => array(
'image_link' => '',
'image_style' => '',
),
'type' => 'image',
'weight' => '4',
),
),
'entity_type' => 'taxonomy_term',
'field_name' => 'field_farm_images',
'label' => 'Images',
'required' => 0,
'settings' => array(
'alt_field' => 0,
'default_image' => 0,
'file_directory' => '',
'file_extensions' => 'png gif jpg jpeg',
'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' => 'throbber',
),
'type' => 'image_image',
'weight' => '3',
),
),
);
// Exported field: 'taxonomy_term-farm_crops-field_farm_maturity_days'.
$fields['taxonomy_term-farm_crops-field_farm_maturity_days'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_farm_maturity_days',
'foreign keys' => array(),
'indexes' => array(),
'locked' => '0',
'module' => 'number',
'settings' => array(),
'translatable' => '0',
'type' => 'number_integer',
),
'field_instance' => array(
'bundle' => 'farm_crops',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'number',
'settings' => array(
'decimal_separator' => '.',
'prefix_suffix' => TRUE,
'scale' => 0,
'thousand_separator' => ' ',
),
'type' => 'number_integer',
'weight' => '2',
),
),
'entity_type' => 'taxonomy_term',
'field_name' => 'field_farm_maturity_days',
'label' => 'Days to maturity',
'required' => 0,
'settings' => array(
'max' => '',
'min' => '',
'prefix' => '',
'suffix' => ' day| days',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'number',
'settings' => array(),
'type' => 'number',
'weight' => '2',
),
),
);
// Translatables
// Included for use with string extractors like potx.
t('Companions');
t('Crop family');
t('Days to maturity');
t('Files');
t('Images');
return $fields;
}

19
farm_crop.features.inc Normal file
View file

@ -0,0 +1,19 @@
<?php
/**
* @file
* farm_crop.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function farm_crop_ctools_plugin_api() {
list($module, $api) = func_get_args();
if ($module == "field_group" && $api == "field_group") {
return array("version" => "1");
}
list($module, $api) = func_get_args();
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}

View file

@ -0,0 +1,36 @@
<?php
/**
* @file
* farm_crop.features.taxonomy.inc
*/
/**
* Implements hook_taxonomy_default_vocabularies().
*/
function farm_crop_taxonomy_default_vocabularies() {
return array(
'farm_crops' => array(
'name' => 'Crops',
'machine_name' => 'farm_crops',
'description' => 'A taxonomy of crop types and varieties.',
'hierarchy' => '1',
'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',
),
),
),
),
);
}

101
farm_crop.field_group.inc Normal file
View file

@ -0,0 +1,101 @@
<?php
/**
* @file
* farm_crop.field_group.inc
*/
/**
* Implements hook_field_group_info().
*/
function farm_crop_field_group_info() {
$export = array();
$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_data|taxonomy_term|farm_crops|form';
$field_group->group_name = 'group_farm_data';
$field_group->entity_type = 'taxonomy_term';
$field_group->bundle = 'farm_crops';
$field_group->mode = 'form';
$field_group->parent_name = '';
$field_group->data = array(
'label' => 'Crop Data',
'weight' => '2',
'children' => array(
0 => 'field_farm_maturity_days',
),
'format_type' => 'fieldset',
'format_settings' => array(
'label' => 'Crop Data',
'instance_settings' => array(
'required_fields' => 1,
'classes' => 'group-farm-data field-group-fieldset',
'description' => '',
),
'formatter' => 'collapsed',
),
);
$export['group_farm_data|taxonomy_term|farm_crops|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_details|taxonomy_term|farm_crops|form';
$field_group->group_name = 'group_farm_details';
$field_group->entity_type = 'taxonomy_term';
$field_group->bundle = 'farm_crops';
$field_group->mode = 'form';
$field_group->parent_name = '';
$field_group->data = array(
'label' => 'Crop Details',
'weight' => '1',
'children' => array(
0 => 'field_farm_companions',
1 => 'field_farm_crop_family',
2 => 'description',
),
'format_type' => 'fieldset',
'format_settings' => array(
'label' => 'Crop Details',
'instance_settings' => array(
'required_fields' => 1,
'classes' => 'group-farm-details field-group-fieldset',
'description' => '',
),
'formatter' => 'open',
),
);
$export['group_farm_details|taxonomy_term|farm_crops|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_files|taxonomy_term|farm_crops|form';
$field_group->group_name = 'group_farm_files';
$field_group->entity_type = 'taxonomy_term';
$field_group->bundle = 'farm_crops';
$field_group->mode = 'form';
$field_group->parent_name = '';
$field_group->data = array(
'label' => 'Attach Files',
'weight' => '3',
'children' => array(
0 => 'field_farm_images',
1 => 'field_farm_files',
),
'format_type' => 'fieldset',
'format_settings' => array(
'label' => 'Attach Files',
'instance_settings' => array(
'required_fields' => 1,
'classes' => 'group-farm-files field-group-fieldset',
'description' => '',
),
'formatter' => 'collapsed',
),
);
$export['group_farm_files|taxonomy_term|farm_crops|form'] = $field_group;
return $export;
}

25
farm_crop.info Normal file
View file

@ -0,0 +1,25 @@
name = Farm Crop
description = Features for managing farm crops.
core = 7.x
package = Farm
dependencies[] = features
dependencies[] = field_group
dependencies[] = image
dependencies[] = number
dependencies[] = pathauto
dependencies[] = strongarm
dependencies[] = taxonomy
features[ctools][] = field_group:field_group:1
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:1
features[field][] = taxonomy_term-farm_crops-field_farm_companions
features[field][] = taxonomy_term-farm_crops-field_farm_crop_family
features[field][] = taxonomy_term-farm_crops-field_farm_files
features[field][] = taxonomy_term-farm_crops-field_farm_images
features[field][] = taxonomy_term-farm_crops-field_farm_maturity_days
features[field_group][] = group_farm_data|taxonomy_term|farm_crops|form
features[field_group][] = group_farm_details|taxonomy_term|farm_crops|form
features[field_group][] = group_farm_files|taxonomy_term|farm_crops|form
features[taxonomy][] = farm_crops
features[variable][] = field_bundle_settings_taxonomy_term__farm_crops
features[variable][] = pathauto_taxonomy_term_farm_crops_pattern

7
farm_crop.module Normal file
View file

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

61
farm_crop.strongarm.inc Normal file
View file

@ -0,0 +1,61 @@
<?php
/**
* @file
* farm_crop.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function farm_crop_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_taxonomy_term__farm_crops';
$strongarm->value = array(
'view_modes' => array(
'full' => array(
'custom_settings' => FALSE,
),
'diff_standard' => array(
'custom_settings' => FALSE,
),
'token' => array(
'custom_settings' => FALSE,
),
),
'extra_fields' => array(
'form' => array(
'name' => array(
'weight' => '0',
),
'description' => array(
'weight' => '4',
),
'path' => array(
'weight' => '4',
),
),
'display' => array(
'description' => array(
'default' => array(
'weight' => '0',
'visible' => TRUE,
),
),
),
),
);
$export['field_bundle_settings_taxonomy_term__farm_crops'] = $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_crops_pattern';
$strongarm->value = 'farm/crop/[term:name]';
$export['pathauto_taxonomy_term_farm_crops_pattern'] = $strongarm;
return $export;
}