Add fields to sensors: description, photos, files.

This commit is contained in:
Michael Stenta 2017-05-19 20:52:37 -04:00
parent 6d8e68d8df
commit f8128a1b92
3 changed files with 157 additions and 0 deletions

View File

@ -8,13 +8,18 @@ DEPENDENCIES
This module depends on the following modules:
* Colorbox (http://drupal.org/project/colorbox)
* Ctools (http://drupal.org/project/ctools)
* Entity API (http://drupal.org/project/entity)
* Features (http://drupal.org/project/features)
* Multiupload Filefield Widget (http://drupal.org/project/multiupload_filefield_widget)
* Multiupload Imagefield Widget (http://drupal.org/project/multiupload_imagefield_widget)
* Pathauto (http://drupal.org/project/pathauto)
* Strongarm (http://drupal.org/project/strongarm)
* Views (http://drupal.org/project/views)
* Views Bulk Operations (http://drupal.org/project/views_bulk_operations)
* Farm Asset (http://drupal.org/project/farm_asset)
* Farm Fields (http://drupal.org/project/farm_fields)
* Farm Log (http://drupal.org/project/farm_log)
INSTALLATION

View File

@ -0,0 +1,141 @@
<?php
/**
* @file
* farm_sensor.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function farm_sensor_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'farm_asset-sensor-field_farm_description'.
$field_instances['farm_asset-sensor-field_farm_description'] = array(
'bundle' => 'sensor',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 0,
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_description',
'label' => 'Description',
'required' => 0,
'settings' => array(
'text_processing' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'rows' => 5,
),
'type' => 'text_textarea',
'weight' => 2,
),
);
// Exported field_instance: 'farm_asset-sensor-field_farm_files'.
$field_instances['farm_asset-sensor-field_farm_files'] = array(
'bundle' => 'sensor',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'file',
'settings' => array(),
'type' => 'file_table',
'weight' => 2,
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_files',
'label' => 'Files',
'required' => 0,
'settings' => array(
'description_field' => 1,
'file_directory' => 'farm/asset/sensor',
'file_extensions' => 'csv doc docx odt odp ods pdf ppt pptx txt xls xlsx kml kmz zip tar gz',
'max_filesize' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'multiupload_filefield_widget',
'settings' => array(
'progress_indicator' => 'bar',
),
'type' => 'file_mfw',
'weight' => 4,
),
);
// Exported field_instance: 'farm_asset-sensor-field_farm_images'.
$field_instances['farm_asset-sensor-field_farm_images'] = array(
'bundle' => 'sensor',
'default_value' => array(),
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'colorbox',
'settings' => array(
'colorbox_caption' => 'auto',
'colorbox_caption_custom' => '',
'colorbox_gallery' => 'post',
'colorbox_gallery_custom' => '',
'colorbox_image_style' => '',
'colorbox_multivalue_index' => NULL,
'colorbox_node_style' => 'thumbnail',
'colorbox_node_style_first' => 'large',
),
'type' => 'colorbox',
'weight' => 1,
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_images',
'label' => 'Photo(s)',
'required' => 0,
'settings' => array(
'alt_field' => 0,
'default_image' => 0,
'file_directory' => 'farm/asset/sensor',
'file_extensions' => 'png gif jpg jpeg',
'max_filesize' => '',
'max_resolution' => '',
'min_resolution' => '',
'title_field' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'multiupload_imagefield_widget',
'settings' => array(
'preview_image_style' => 'thumbnail',
'progress_indicator' => 'bar',
),
'type' => 'image_miw',
'weight' => 3,
),
);
// Translatables
// Included for use with string extractors like potx.
t('Description');
t('Files');
t('Photo(s)');
return $field_instances;
}

View File

@ -2,12 +2,20 @@ name = Farm Sensor
description = Features for managing farm sensors.
core = 7.x
package = farmOS
dependencies[] = colorbox
dependencies[] = ctools
dependencies[] = entity
dependencies[] = farm_asset
dependencies[] = farm_fields
dependencies[] = farm_log_movement
dependencies[] = features
dependencies[] = file
dependencies[] = image
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = pathauto
dependencies[] = strongarm
dependencies[] = text
dependencies[] = views
dependencies[] = views_bulk_operations
dependencies[] = views_data_export
@ -15,5 +23,8 @@ features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[farm_asset_type][] = sensor
features[features_api][] = api:2
features[field_instance][] = farm_asset-sensor-field_farm_description
features[field_instance][] = farm_asset-sensor-field_farm_files
features[field_instance][] = farm_asset-sensor-field_farm_images
features[variable][] = pathauto_farm_asset_sensor_pattern
features[views_view][] = farm_sensors