Add sensor_type and sensor_settings fields to sensor asset properties.

This commit is contained in:
paul121 2020-07-23 15:04:34 -07:00 committed by Michael Stenta
parent 214483c18f
commit 1addc94cae
1 changed files with 22 additions and 0 deletions

View File

@ -33,6 +33,28 @@ function farm_sensor_farm_ui_entity_view_groups() {
return $groups;
}
/**
* Implements hook_entity_property_info_alter().
*/
function farm_sensor_entity_property_info_alter(&$info) {
// Add a sensor type property to sensor assets.
$info['farm_asset']['bundles']['sensor']['properties']['sensor_type'] = array(
'type' => 'text',
'label' => t('Sensor Type'),
'description' => t('The type of sensor.'),
'setter callback' => 'entity_property_verbatim_set',
);
// Add a sensor settings property to sensor assets.
$info['farm_asset']['bundles']['sensor']['properties']['sensor_settings'] = array(
'type' => 'unknown',
'label' => t('Sensor Settings'),
'description' => t('Settings for this sensor.'),
'setter callback' => 'entity_property_verbatim_set',
);
}
/**
* Implements hook_entity_load().
*/